First of all let me say that this questions is slightly connected to another question by me. Actually it was created because of that.
I have the following code to wr
I used this hack to fix error:
...
Uri hacked_uri = Uri.parse("file://" + uri.getPath());
intent.setDataAndType(hacked_uri, "image/*");
...
I used this code for my app and works fine. I only did a litle change.
I changed This:
intent.setDataAndType(Uri.parse(posterFile.getAbsolutePath()),"image/*");
For this:
intent.setDataAndType(Uri.fromFile(posterFile),"image/*");
I decided to create my own Activity which simply draws the image on the screen. It is not a perfect solution but it meets my basic standards... It works :)
i use this code
MediaScannerConnection.scanFile(PayamKhosusiActivity.this, new String[] { filez.toString() },
null, new MediaScannerConnection.OnScanCompletedListener() {
@Override
public void onScanCompleted(String path, Uri uri) {
Log.wtf("onScanCompleted", "yes");
Intent intent = new Intent(Intent.ACTION_VIEW, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setDataAndType(uri, "image/*");
intent.setFlags(FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION); //must for reading data from directory
startActivity(intent);
}
});