Thursday, 29 August 2013

ACTION_VIEW Intent to show image not working on 2.3

ACTION_VIEW Intent to show image not working on 2.3

I'm using the following code to display an image that I have saved on the
device. This works fine in Android 4.2, but when I use it on 2.3 , the
gallery opens but shows a black screen (never loads the image). I don't
see any errors being thrown either.
I can confirm the file exists, and the path created is correct (as I said
it works in 4.2)
private void viewPicture(File file, Context context){
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "image/*");
context.startActivity(intent);
}

No comments:

Post a Comment