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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:07:24+00:00 2026-06-04T05:07:24+00:00

I am starting a request for an image pick: Intent intent = new Intent();

  • 0

I am starting a request for an image pick:

Intent intent = new Intent();
intent.setType( "image/*" );
intent.setAction( Intent.ACTION_GET_CONTENT );
startActivityForResult( Intent.createChooser( intent, "Choose"), PHOTO_GALLERY );

And getting the data back out in onActivityResult:

if( resultCode == Activity.RESULT_OK && requestCode == PHOTO_GALLERY )
{
  U.log( data.getData() );
  Bitmap bm = ... // built from the getData() Uri
  this.postImagePreview.setImageBitmap( bm );
}

When I launch the Intent, I see some folders, such as sdcard, Drop Box, MyCameraApp, and so on.

If I chose a picture from sdcard, when I load the preview, it is the completely wrong image. The other folders don’t seem to be giving me this problem.

Does anyone know why it’d let me pick one image, then give me the Uri for another?

EDIT: Here are some exampled logged getData()s:

Good:

content://com.google.android.gallery3d.provider/picasa/item/5668377679792530210

Bad:

content://media/external/images/media/28

EDIT: I’m still having issues, when picking from the sdcard folder of gallery.

Here is a bit more expansion of what I’m doing in onActivityResult:

// cursor
Uri selectedImage = data.getData();

String[] filePathColumn = { MediaStore.Images.Media.DATA };

Cursor cursor = mContext.getContentResolver().query( selectedImage, filePathColumn, null, null, null );
cursor.moveToFirst();

int columnIndex = cursor.getColumnIndex( filePathColumn[0] );
String filePath = cursor.getString( columnIndex );
cursor.close();

// Cursor: /mnt/sdcard/Pic.jpg : /mnt/sdcard/Pic.jpg
U.log( "Cursor: " + filePath + " : " + Uri.parse( filePath ) );

// "regular" 

// Regular: content://media/external/images/media/28 : content://media/external/images/media/28
U.log( "Regular: " + data.getDataString() + " : " + Uri.parse( data.getDataString() ) );

// Regular 2: content://media/external/images/media/28 : content://media/external/images/media/28
U.log( "Regular 2: " + data.getData() + " : " + data.getData() );


mPostImagePreview.setImageBitmap( BitmapFactory.decodeFile( filePath ) );
mPostImagePreview.setVisibility( View.VISIBLE );

They still set the wrong image. If I go into the Gallery, long press the image, and view its details I get:

TItle: Pic
Time: May 2, 2012
Width: 720
Height: 1280
Orientation: 0
File size: 757KB
Maker: Abso Camera
Model: Inspire 4G
Path: /mnt/sdcard/Pic.jpg

So, the Gallery is telling me the path is the same as the pick action, and the Gallery is rendering it correctly. So why on earth is it not rendering if I set it from onActivityResult?

Also, this is the code I’m using to fire the Intent now:

private void selectPhoto()
{
  Intent intent = new Intent( Intent.ACTION_GET_CONTENT );
  intent.setType( "image/*" );
  ( ( Activity )mContext ).startActivityForResult( Intent.createChooser( intent, "Select Picture" ), PHOTO_GALLERY );
}
  • 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-06-04T05:07:26+00:00Added an answer on June 4, 2026 at 5:07 am

    Sometimes the thumbnails in the gallery app can be outdated and show thumbnails for a different image. This can happen when the image ids are reused, for example when an image gets deleted and a new one is added using the same id.

    Manage Apps > Gallery > Clear Data can fix this problem then.

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

Sidebar

Related Questions

Starting with no cache on server or client FIRST REQUEST GET /post/1 HTTP/1.1 HTTP/1.1
Starting a new rails project and we have a well-thought-out color palette, and want
Starting a new big C multiplatform project, what rules should one follow to avoid
Starting a new project using EJB 3 / JPA, mainly stateless session beans and
The first comment on a feature request for g++ says, Starting with 4.5 you
I've been considering image hosting services for a project but am starting to wonder
My ajax request is not being processed. I receive the warning when starting my
With Openssl, how could I create a certificate request, starting only from a public
I'm starting work on a small web based request system which needs to implement
I'm just starting out in Python and I'm trying to request the html source

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.