0
URLから画像を読み込む際にはWebView
に保存しますが保存しません。保存する方法アンドロイドでWebViewをダウンロードする
これは私のコードです。
Uri uri="http://202.87.34.17/MobileDetect/Wallpaper/Wallpaper_01.jpg";
widget29=(WebView)findViewById(R.id.widget29);
widget29.loadUrl(IMAGE);
save();
try{
String path = Environment.getExternalStorageDirectory().toString();
OutputStream fOut = null;
File file = new File(path, "/sdcard"+IMAGE_FILENAME+".jpg");
fOut = new FileOutputStream(file);
Bitmap mBitmap = null;
mBitmap.compress(Bitmap.CompressFormat.JPEG, 85, fOut);
fOut.flush();
fOut.close();
MediaStore.Images.Media.insertImage(getContentResolver(),
file.getAbsolutePath(), file.getName(),file.getName());
} catch (Exception e) {
e.printStackTrace();
}
どのような問題がありますか?pls logcatを正しく見直すために貼り付けてください –
次回にコードをフォーマットしてみてください。 'save()'メソッドは何をしていますか? –
ここで、ビットマップのインスタンスを作成しますか? – Moystard