2
A
回答
2
下面的代码工作对我很好,
class DownloadImage extends AsyncTask<Void, Void, Drawable>{
@Override
protected Drawable doInBackground(Void... params) {
return Util.getImageFromURL(imageURL);
}
@Override
protected void onPostExecute(Drawable d) {
getImageIcon().setImageDrawable(d);
}
}
new DownloadImage().execute();
,如果你是显示列表视图图像应按照此 http://github.com/commonsguy/cwac-thumbnail
2
@Praveenb 试试以下,
Bitmap bmImg;
void downloadFile(String fileUrl){
URL myFileUrl =null;
try {
myFileUrl= new URL(fileUrl);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
bmImg = BitmapFactory.decodeStream(is);
// it will decode the input stream and will load the bitmat in bmImg variable
imView.setImageBitmap(bmImg);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
相关问题
- 1. 来自图片库的Android图片
- 2. 来自Retina Display的URL的图片
- 3. 来自Android的URL中的图片加载问题
- 4. 保存来自URL的流
- 5. 动态更新图片来自URL与Android
- 6. 来自StorageReference的图片Firebase-Android
- 7. 来自URL的Android可绘制图像
- 8. 来自AWS S3的流式图像
- 9. 来自Gopro的Android流
- 10. 联系图片来自XMPP android
- 11. 如何打开来自url的特定图片的colorbox图库?
- 12. PHP来自url的图片的缩略图
- 13. 来自Url的Android动作
- 14. 来自url的Android ImageButton
- 15. url来源图片javascript
- 16. 来自webrick的流式html?
- 17. 来自照片库的Android图片的真实路径
- 18. 来自Picasa的小图片
- 19. 来自Simplepie feed的图片?
- 20. 来自UIView的图片
- 21. 来自URL的Swift图像
- 22. 来自URL的图片不遵循故事板的样式规则
- 23. koa.js来自远程URL的流式响应
- 24. 使用来自web url的eclipse流式音频
- 25. 来自android中的url的图库图像?
- 26. 如何在黑莓中显示来自URL的图片?
- 27. 来自外部URL的Facebook事件个人资料图片
- 28. Android图库与来自url文件夹的图像
- 29. android中的图片格式
- 30. 图片URL创建位图android
嗨sohilvassa, 我看到你在imageview中显示来自url的图像。 这张图片是否会不断更新url ?.请让我知道如果我能得到这项工作。 感谢您的回复 – praveenb 2010-07-09 18:18:20