// 获取指定路径的图片
public static Bitmap getImage(String urlpath)
throws Exception {
URL url = new URL(urlpath);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5 * 1000);
Bitmap bitmap = null;
if (conn.getResponseCode() == 200) {
InputStream inputStream = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(inputStream);
}
return bitmap;
}

更多相关文章

  1. android---图片切换
  2. Android ImageView图片显示点击背景切换
  3. Android中图片占用内存的计算
  4. Android imageView图片按比例缩放(转)
  5. android中九宫图整齐排列(图片处理)
  6. Android studio实现左右滑动切换图片
  7. Android-给图片添加暗影
  8. Java和Android Http连接程序:使用java.net.URL 下载服务器图片到

随机推荐

  1. Android(安卓)中the connection to adb i
  2. Android(安卓)驱动与应用
  3. android 背景圆角以及图片圆角处理
  4. Android控件开发之四----ListView(2)
  5. Android(安卓)ImageView、TextureView、
  6. Android(安卓)Studio对于Java8特性的支持
  7. Android(安卓)技术栈总结
  8. Android(安卓)SystemUI 信号栏后添加信号
  9. Android(安卓)BroadcastReceiver
  10. Android之常用布局