public static Bitmap getBitmapFromServer(String imagePath) {HttpGet get = new HttpGet(imagePath);HttpClient client = new DefaultHttpClient();Bitmap pic = null;try {HttpResponse response = client.execute(get);HttpEntity entity = response.getEntity();InputStream is = entity.getContent();pic = BitmapFactory.decodeStream(is);   // 关键是这句代码} catch (ClientProtocolException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}return pic;}

其中imagePath是你的图片路径,比如:http://localhost:8080/app/images/abc.jpg

最后可以将图片显示在手机上:

imageView.setImageBitmap(bitmap);


更多相关文章

  1. android中获取当前程序路径
  2. Android中ListView中显示图片和文本
  3. Android关于图片压缩
  4. Android 9Patch图片
  5. android xml中设置自适应图片
  6. Android 之 ImageView(图片组件)
  7. android多点触摸缩放图片

随机推荐

  1. Hello Android(安卓)- proguard混淆器使
  2. Android下修改hosts文件
  3. Android(安卓)2.2新增Widget之ProtipWidg
  4. 转载关于android高效显示图片的文章---Fr
  5. Adobe AIR for Android(安卓)中的GPU 渲
  6. Android(安卓)ListView组件中androiddraw
  7. Android的View和ViewGroup分析
  8. Android应用程序请求SurfaceFlinger服务
  9. android activity开发文档翻译 - 1 - 基
  10. Android(安卓)Studio保存log到本地