Skip to content Skip to sidebar Skip to footer

Problem In Opening Photoviewer For Displaying All The Images Stored In A Particular Folder In Android

I have one activity(MyActivity), in which I have a grid view. Also I have the 'add existing photo from gallery ' button. When we click on this button it will open the gallery viewe

Solution 1:

Use the following logic to get path of all images present in gallery. Create your own PhotoGrid to display all images. write separate activity where you have an image view to show the image and next or previous buttons. if you click next button increase the counter set image which is present in that position in ArrayList.

ArrayList<String> listOfAllImages = newArrayList<String>();
String absolutePathOfImage = null;
uri = android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI;

            String[] projection = { MediaColumns.DATA,
                    MediaColumns.DISPLAY_NAME };

            cursor = activity.managedQuery(uri, projection, null, null, null);
            column_index = cursor.getColumnIndexOrThrow(MediaColumns.DATA);
while (cursor.moveToNext()) {
absolutePathOfImage = cursor.getString(column_index);
listOfAllImages.add(absolutePathOfImage);
}

Thanks Deepak

Post a Comment for "Problem In Opening Photoviewer For Displaying All The Images Stored In A Particular Folder In Android"