下载图像后,将它们保存到此位置
String extStorageDirectory;
protected void onCreate(Bundle icicle) {
extStorageDirectory = Environment.getExternalStorageDirectory().toString(); //set it to the SD card directory
}
public void savetoSD(Integer Index) //Index is what pic number it is 1 through 9
{
OutputStream outStream = null;
String filename = "Hentai" + System.currentTimeMillis() + ".JPEG";
String filepath = extStorageDirectory + "/media/pictures/MyAppsDownloadFolder/" + filename;
File file = new File(filepath);
try {
outStream = new FileOutputStream(file);
//get a download here for the real bitmap
DownloadFromUrl(myMainPicURL[Index],filename);
Bitmap saveME = null;
saveME = BitmapFactory.decodeFile(PATH+filename);
saveME.compress(Bitmap.CompressFormat.JPEG, 100, outStream);
outStream.flush();
outStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//need to refresh the damned MediaScanner
try {
MediaStore.Images.Media.insertImage(getContentResolver(), filepath, filename, "myDownloadedPics");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
message_user("Saved as " + filepath);
}
我认为媒体商店不起作用或我不知道如何使用它请帮助
我希望下载的图片出现在图库中,或者至少有一个文件夹MyAppsDownloadFolder在图库中显示它不会!