user1610075
user1610075

Reputation: 1641

Intent for image display

I've a sequence of image paths on my sd card and I display them on a list. I'd like to associate the onitemclick to image visualization and, rather than create my own activity, I wanted to know if there was an intent which, given an image path, displays it.

Upvotes: 0

Views: 85

Answers (1)

iTurki
iTurki

Reputation: 16398

This solution assumes that you have the path of your image:

Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(path)), "image/png");
startActivity(intent);

Upvotes: 1

Related Questions