Android实用的代码片段 常用代码总结

内容摘要
1:查看是否有存储卡插入
http://www.baidu.com/1.html");

HttpResponse resp;

Reader reader = null;

try {

// A
文章正文

1:查看是否有存储卡插入

http://www.baidu.com/1.html");
            HttpResponse resp;
            Reader reader = null;
            try {
                // AllClientPNames.TIMEOUT
                HttpParams params = new BasicHttpParams();
                params.setIntParameter(AllClientPNames.CONNECTION_TIMEOUT, 10000);
                httpClient.setParams(params);
                resp = httpClient.execute(method);
                int status = resp.getStatusLine().getStatusCode();
                if (status != HttpStatus.SC_OK) return false;
                // HttpStatus.SC_OK;
                return true;
            } catch (ClientProtocolException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } finally {
                if (reader != null) try {
                    reader.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }


代码注释

作者:喵哥笔记

IDC笔记

学的不仅是技术,更是梦想!