How to scroll among images viewed via intent in android

不羁的心 提交于 2019-12-02 20:43:45

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/34838866/how-to-scroll-among-images-viewed-via-intent-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!