如题:谢谢各位
------解决方案--------------------
httpRequest.addHeader("if-Modified-Since", feed.date);
------解决方案--------------------
private static synchronized void getHttpClient() {
if (httpClient == null) {
HttpParams httpparameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpparameters, 20000);// 设置连接超时
HttpConnectionParams.setSoTimeout(httpparameters, 25000);// 设置请求超时
HttpConnectionParams.setSocketBufferSize(httpparameters, 8192);
//最大待待时间
ConnManagerParams.setTimeout(httpparameters, 30000);
SchemeRegistry schReg = new SchemeRegistry();
schReg.register(new Scheme("http", PlainSocketFactory
.getSocketFactory(), 80));
schReg.register(new Scheme("https", SSLSocketFactory
.getSocketFactory(), 443));
ClientConnectionManager conMgr = new ThreadSafeClientConnManager(
httpparameters, schReg);
httpClient = new DefaultHttpClient(conMgr, httpparameters);
}
}
getHttpClient();
httpGet.setURI(new URI(strurl));
HttpResponse response = httpClient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
ins = response.getEntity().getContent();
}
// url.openConnection().setDefaultUseCaches(true);
Options options = new Options();
options.inJustDecodeBounds = true;
bitmap = BitmapFactory.decodeStream(ins, null, options);
int srcWidth = options.outWidth;
ins.close();
ins = null;
options.inJustDecodeBounds = false;
Log.d("Tag", "with:" + options.outWidth);
// int be = (int) (((double) options.outWidth) / ((double)
// displayWidth));
int be = 0;
be = (int) Math
.round(((((double) srcWidth) / displayWidth)));
options = new Options();
options.inSampleSize = be;
// ins = url.openStream();
response = httpClient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
ins = response.getEntity().getContent();
}
bitmap = BitmapFactory.decodeStream(ins, null, options);