Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4625550
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:17:19+00:00 2026-05-22T03:17:19+00:00

I have one activity(MyActivity), in which I have a grid view. Also I have

  • 0

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 viewer application and after selecting any photo in gallery it will update the gridview in MyActivity.
Also I am storing the selected photos in the myimage folder in sdcard.

I want that if I will select any particular cell in grid view it will open the photoviewer to display all the images present in that folder (myimage).

The code is given below

public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
        try {

        Intent intent = new Intent(Intent.ACTION_VIEW);

        intent.setDataAndType(Uri.parse("file:///sdcard/myimage/*"), 
        "image/*"); 

        startActivity(intent); 

}

This code, on clicking particular cell of grid view, opens the photoviewer, but not showing any photos in that folder.

But if I use this code

public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
        try {

        Intent intent = new Intent(Intent.ACTION_VIEW);

        intent.setDataAndType(Uri.parse("file:///sdcard/myimage/a.jpg"), 
        "image/*"); 

        startActivity(intent); 

}

it is showing only the photo a.jpg, not all the photos in the myimage folder. Also not showing the next and previous arrow in the photoviewer.

I want to display all the images present in a particular folder in sd card with next and previous arrow so, that we can traverse through all the photos.

If this is not possible in this way, suggest me other approach(please attach the code also).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:17:20+00:00Added an answer on May 22, 2026 at 3:17 am

    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 = new ArrayList<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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within one Activity I have th following piece of code: public void onStartMonitoringToggleClicked(View v)
i have main activity in which i have Four menus. and i have one
In my app, I have only one Activity which hosts several fragments . The
I have a simple activity with only one edittext which was set to http://
I have an activity in android which I set up a button under a
I have implemented onRetainNonConfigurationInstance() on one of my Activity to handle android screen orientation.
I have a design of activities like this I have one main activity and
I am trying to display ListView . I have created one activity , in
My one activity seems to have grown quite a bit and I feel like
I have one SubjectTabActivity and i need to show listview on this activity. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.