如何从网上下载图像并将其保存在内部存储中?之后,我该如何显示它?任何帮助将不胜感激
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Bitmap bitmap = getBitmap("http://www.parkcinema.az/uploads/structures/movies/images/vozvra%C3%BCenie_geroya_poster1_resized.jpg");
ImageView image = (ImageView)findViewById(R.id.pick);
image.setImageBitmap(bitmap);
}
public Bitmap getBitmap(String bitmapUrl){
try {
URL url = new URL(bitmapUrl);
return BitmapFactory.decodeStream(url.openConnection().getInputStream());
}
catch(Exception ex) {return null;}
}