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 6046797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:16:51+00:00 2026-05-23T07:16:51+00:00

I want any one image present in the sdcard . I only know the

  • 0

I want any one image present in the sdcard.
I only know the image name.
But how can i retrieve that particular image within my program(including path). And also to convert into a bitmap or stored in a bitmap variable
How can I do that?
Thank you

  • 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-23T07:16:52+00:00Added an answer on May 23, 2026 at 7:16 am

    Here, you can show all images in SDCard and when you click one of them, you get the path of selected image:

    try {
            // Set up an array of the Thumbnail Image ID column we want
            String[] projection = { MediaStore.Images.Thumbnails._ID };
            // Create the cursor pointing to the SDCard
            cursor = managedQuery(
                    MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
                    projection, // Which columns to return
                    null, // Return all rows
                    null, MediaStore.Images.Thumbnails.IMAGE_ID);
    
    
            // Get the column index of the Thumbnails Image ID
            columnIndex = cursor
                    .getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);
    
            GridView sdcardImages = (GridView) findViewById(R.id.gallary);
            sdcardImages.setAdapter(new ImageAdapter(this));
    
            // Set up a click listener
            sdcardImages.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView parent, View v,
                        int position, long id) {
                    // Get the data location of the image
                    String[] projection = { MediaStore.Images.Media.DATA };
                    cursor = managedQuery(
                            MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                            projection, // Which columns to return
                            null, // Return all rows
                            null, null);
                    columnIndex = cursor
                            .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
                    cursor.moveToPosition(position);
                    // Get image filename
                    String imagePath = cursor.getString(columnIndex);
                    // Use this path to do further processing, i.e. full screen
                    // display
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    

    And here is the ImageAdapter:

    /**
     * Adapter for our image files.
     */
    private class ImageAdapter extends BaseAdapter {
    
        private Context context;
    
        public ImageAdapter(Context localContext) {
            context = localContext;
        }
    
        public int getCount() {
            return cursor.getCount();
        }
    
        public Object getItem(int position) {
            return position;
        }
    
        public long getItemId(int position) {
            return position;
        }
    
        public View getView(int position, View convertView, ViewGroup parent) {
            ImageView picturesView;
            if (convertView == null) {
                picturesView = new ImageView(context);
                // Move cursor to current position
                cursor.moveToPosition(position);
                // Get the current value for the requested column
                int imageID = cursor.getInt(columnIndex);
                // Set the content of the image based on the provided URI
                picturesView.setImageURI(Uri.withAppendedPath(
                        MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, ""
                                + imageID));
                picturesView.setScaleType(ImageView.ScaleType.FIT_CENTER);
                picturesView.setPadding(8, 8, 8, 8);
                picturesView
                        .setLayoutParams(new GridView.LayoutParams(100, 100));
            } else {
                picturesView = (ImageView) convertView;
            }
            return picturesView;
        }
    }
    

    And if you know the exact path and image name, you can get Bitmap by using:

    Bitmap bitmap = BitmapFactory.decodeFile("yourImageDirectory" + "yourImageName.png");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We only want one instance of our app running at any one time. So
I want to create a box like this with title: Can any one please
I want to try out SICP with Python. Can any one point to materials
If I have Model.objects.all() I want to get only one object for any content_object=foo,
I have this WP Plugin that I want to edit, but I just can't
Anyone know? Want to be able to on the fly stamp an image with
I want to drag and drop an image on wpf application form. Can anyone
I want to publish message on Facebook's fan page using JAVA/GWT API. Any one
I don't want to rely on the one-click installer any more, and I want
I was wondering if any one can be kind and help me, I was

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.