我正在使用 Asynctask 从互联网下载图像。
我想将此图像保存到内部存储中,稍后我想使用此图像。
我可以成功下载,但我找不到它存储的内部存储路径。
这个下载Images.java
private class DownloadImages extends AsyncTask<String,Void,Bitmap> {
private Bitmap DownloadImageBitmap(){
HttpURLConnection connection = null;
InputStream is = null;
try {
URL get_url = new URL("http://www.medyasef.com/wp-content/themes/medyasef/images/altlogo.png");
connection = (HttpURLConnection) get_url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.connect();
is = new BufferedInputStream(connection.getInputStream());
final Bitmap bitmap = BitmapFactory.decodeStream(is);
// ??????????
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
finally {
connection.disconnect();
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
@Override
protected Bitmap doInBackground(String... params) {
return DownloadImageBitmap();
}
}
任何帮助将不胜感激。:)
谢谢你。