Waterbyte Waterbyte - 3 years ago 153
Android Question

How to scroll among images viewed via intent in android

I have created a function to view images in a single view using following Intent.

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


It opens a default gallery app to view the images. However I cannot go to next image by sliding the screen as it normally happens in simple gallery app. How could I do it?
The scenario is I have a grid view displaying thumbnails of pics. Now when somebody click on it, it is opened via intent and displayed in full screen but to see next image, user has to go back and then click the next image. What would be the procedure to switch images when a person slide the screen horizontally.

Answer Source

I got the answer. Actually, I was not able to swipe the images to see next one because the default gallery app doesn't knew that more image exists in that path. So I notified the media resolver using broadcast intent and then I was able to swipe images.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download