我試圖共享使用共享意圖保存到內部存儲的圖像文件。 我意圖圖像文件不顯示後。Android共享意圖共享圖像不存在
我用下面的代碼來保存圖像文件
try {
FileOutputStream fos = openFileOutput("twitterimage.jpg", Context.MODE_PRIVATE);
// Writing the bitmap to the output stream
bikeBm.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();
} catch (Exception e) {
Log.e("saveToInternalStorage()", e.getMessage());
}
//意圖代碼
File internalFile = getFileStreamPath("twitterimage.jpg");
Uri uri = Uri.fromFile(internalFile);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM,new File(uri));
shareIntent.setType("image/jpeg");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "send"));
當我使用上述「URI」檢查文件所有腦幹,在圖像文件中的存在 內部存儲但檢查文件使用
String file = "data/data/com.bike.app/twitterimage.jpg";
File f = new File(file);
顯示我的文件不存在exis噸。
請幫我解決這個問題。
看吧http://stackoverflow.com/questions/13917495/sharing-on-twitter-and-facebook-via-android-app/13917710#13917710 –