原创作者: 595755330
阅读:5004次
评论:2条
更新时间:2011-06-01
很多时候我们从网络上获取图片,但有时图片路径明明正确,却要出错。图片小无所谓,图片大了就出错了。
ImageView imageView = new ImageView(context);
URL url = new URL("图片路径");
URLConnection conn = url.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 10;
originalImage = BitmapFactory.decodeStream(is,null,options);
imageView.setImageBitmap(bitmapWithReflection);
这样问题就可以解决了
ImageView imageView = new ImageView(context);
URL url = new URL("图片路径");
URLConnection conn = url.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 10;
originalImage = BitmapFactory.decodeStream(is,null,options);
imageView.setImageBitmap(bitmapWithReflection);
这样问题就可以解决了
2 楼 wxw404 2011-07-03 13:53
1 楼 ghc创业者 2010-12-30 11:28