0

Here is my onclick listener for in image obtained from the gallery:

imageView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent();
                    intent.setAction(Intent.ACTION_VIEW);
                    intent.setDataAndType(Uri.parse("mImage"), "image/*");
                    startActivity(intent);
                }});

How ever when i click on the image it just shows a blank black screen with the gallery's controls visible. What should i do?

Gibran Gul
  • 121
  • 1
  • 13
  • possible duplicate of [Open an image using URI in Android's default gallery image viwer](http://stackoverflow.com/questions/5383797/open-an-image-using-uri-in-androids-default-gallery-image-viwer) – Richard Le Mesurier Sep 08 '14 at 14:56

1 Answers1

2
                        Intent intent = new Intent();
                         intent.setAction(Intent.ACTION_VIEW);
                         Uri imgUri = Uri.parse("file://" + yourfilepath);
                         intent.setDataAndType(imgUri, "image/*");
                         startActivity(intent);

Hope this will work for you.

Nirmal
  • 2,340
  • 21
  • 43