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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:56:40+00:00 2026-05-26T10:56:40+00:00

I implemented one application in that application one button is there. if you click

  • 0

I implemented one application in that application one button is there. if you click on that button then camera will be opened using that u can capture some thing. That captured image will be displayed in the app.

But now i want to add one more button. if you click on that then it displays all images in the sdcard(camera related images) in grid view.if you select any image then it will be displayed in the app.

Please can any one suggest me how to implement it.

And one more thing. In this code

Bitmap thumbnail = (Bitmap) data.getExtras().get("data");  

Here “data” means what?

Code:

public class camera extends Activity 
    {

Button camera_btn;
ImageView cap_image;
public static final int CAMERA_PIC_REQUEST = 1;  

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    camera_btn = (Button) findViewById(R.id.camera_btn);
    camera_btn.setOnClickListener(new OnClickListener(){

        @Override
        public void onClick(View v) {

            Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
            startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); 
        }

    });

}

protected void onActivityResult(int requestCode, int resultCode, Intent data) 
{  
    if (requestCode == CAMERA_PIC_REQUEST)
    {  
        if(data != null)
        {
            Bitmap thumbnail = (Bitmap) data.getExtras().get("data");  
            cap_image = (ImageView) findViewById(R.id.cap_image);
            cap_image.setImageBitmap(thumbnail); 
        }
        else
        {
            System.out.println("Please capature the photo");
        }

    }  
}  
}

Exception:
10-20 13:06:35.073: WARN/System.err(5391): java.lang.IllegalArgumentException: no dialog with id 10020 was ever shown via Activity#showDialog

10-20 13:06:35.073: WARN/System.err(5391): at android.app.Activity.missingDialog(Activity.java:2747)

10-20 13:06:35.073: WARN/System.err(5391): at android.app.Activity.dismissDialog(Activity.java:2732)

10-20 13:06:35.083: WARN/System.err(5391): at com.htc.album.TabPluginDevice.ActivityGlanceBase.handleActivityMessage(ActivityGlanceBase.java:161)

10-20 13:06:35.083: WARN/System.err(5391): at com.htc.opensense.album.TemplateActivityBase$ActivityHandler.handleMessage(TemplateActivityBase.java:89)
10-20 13:06:35.083: WARN/System.err(5391): at android.os.Handler.dispatchMessage(Handler.java:99)

10-20 13:06:35.083: WARN/System.err(5391): at android.os.Looper.loop(Looper.java:143)

10-20 13:06:35.083: WARN/System.err(5391): at android.app.ActivityThread.main(ActivityThread.java:4277)

10-20 13:06:35.093: WARN/System.err(5391): at java.lang.reflect.Method.invokeNative(Native Method)

10-20 13:06:35.093: WARN/System.err(5391): at java.lang.reflect.Method.invoke(Method.java:507)

10-20 13:06:35.093: WARN/System.err(5391): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)

10-20 13:06:35.093: WARN/System.err(5391): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)

10-20 13:06:35.093: WARN/System.err(5391): at dalvik.system.NativeStart.main(Native Method)

10-20 13:06:38.523: INFO/LogFilter(726): Couldn’t find the mandatory “Host” HTTP header.

  • 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-26T10:56:41+00:00Added an answer on May 26, 2026 at 10:56 am

    @Frankenstein: Entire process is right except the following code

    Bitmap thumbnail = (Bitmap) data.getExtras().get(“data”);

    Instead of this, do the following process

    1. Get the URI from the intent.

      Uri selectedImageUri = data.getData();

    2. Get the path from the URI

      String filestring = selectedImageUri.getPath();

    3. Get the bitmap using the getThumbnail (ContentResolver cr, long origId, int kind, BitmapFactory.Options options) method.

    Bitmap thumbnail = MediaStore.Images.Thumbnails.getThumbnail(
    getContentResolver(), selectedImageUriId,
    MediaStore.Images.Thumbnails.MINI_KIND,
    (BitmapFactory.Options) null);

    Here getContentResolver()—->Return a ContentResolver instance for your application’s package.
    selectedImageUriId—->ID of the selected Thumbnail.
    This will be getting from the path.

    Ex: Path: /external/images/media/5
    Here “5” is the ID of the selected image. This “5” is getting from the path using string operations.

    Finally the following code instead of the

    Code
    

    //Get the URI from the Intent

    Uri selectedImageUri = data.getData();

    //Get the decoded path from the URI

    String filestring = selectedImageUri.getPath();

    //Get the ID from the path.
    String x = filestring.substring(23);

    long selectedImageUriId = Long.parseLong(x);

    //Get the bitmap

    Bitmap thumbnail = MediaStore.Images.Thumbnails.getThumbnail(
    getContentResolver(), selectedImageUriId,
    MediaStore.Images.Thumbnails.MINI_KIND,
    (BitmapFactory.Options) null);

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

Sidebar

Related Questions

My application is looking like the below snap in some scenario. There is one
I'm looking for a standard dual-map structure - is there one implemented in std/boost/another
Is there anything wrong with having a single class (one .h) implemented over multiple
I have a WCF Service Library (implemented using NH) with one of the class
In a windows forms application, a property change that triggers INotifyPropertyChanged, will result in
I've implemented application state saving/loading in onSave/RestoreInstanceState and onCreate in one of my android
I'm creating an application whose main screen can consist of one of three Scenarios.
I have an Eclipse RCP Standalone Application using Eclipse 3.6. I have implemented a
Every now and then I find web applications that have some sort of article
In one part of the application I'm working on, there is a form control

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.