1
我正在嘗試使用默認圖庫應用程序集成設置爲壁紙選項,我不知道如何使用意圖將圖像發送到圖庫。我附上fb應用程序示例,它的外觀如何。如何將圖像發送到畫廊以設置壁紙?
String root = Environment.getExternalStorageDirectory().toString();
new File(root + "/"+Constants1.APPNAME).mkdirs();
File fileForImage = new File(root + "/"+Constants1.APPNAME, pos + ".jpg");
if (fileForImage.exists()) fileForImage.delete();
try {
FileOutputStream out = new FileOutputStream(fileForImage);
arg0.compress(Bitmap.CompressFormat.PNG, 100, out);
Toast.makeText(getApplicationContext(), "Image is saved to "+Constants1.APPNAME+" folder", Toast.LENGTH_SHORT).show();
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
Intent emailIntent = new Intent(Intent.ACTION_ATTACH);
emailIntent.setType("image/png");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(fileForImage));
startActivityForResult(Intent.createChooser(emailIntent, pos+".jpg"),0);
的問題是圖像不傳遞給畫廊..
我可以使用內部文件Uri.fromFile()? –