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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:03:17+00:00 2026-06-12T12:03:17+00:00

i am facing an issue of taking picture from android camera and then showing

  • 0

i am facing an issue of taking picture from android camera and then showing it to next activity. process works fine but out of 10 pictures 1 picture is missed.

steps: activity a where i invoke camera and take picture then i pass to activity b of its URI to display in image view , repeating this cycle 10 times 1-2 times picture got missed and delay is observed of 2 sec when picture is taken and displayed into image view on next screen in the form of blank screen.

kindly check the code and guide me what mistake am i doing here?

Activity A

 @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(requestCode==CAMERA_IMAGE_CAPTURE && resultCode==Activity.RESULT_OK){

        String[] projection = {
        MediaStore.Images.Thumbnails._ID,  // The columns we want
        MediaStore.Images.Thumbnails.IMAGE_ID,
        MediaStore.Images.Thumbnails.KIND,
        MediaStore.Images.Thumbnails.DATA};
        String selection = MediaStore.Images.Thumbnails.KIND + "="  + // Select only mini's
        MediaStore.Images.Thumbnails.MINI_KIND;

        String sort = MediaStore.Images.Thumbnails._ID + " DESC";

       //At the moment, this is a bit of a hack, as I'm returning ALL images, and just taking the latest one. There is a better way to narrow this down I think with a WHERE clause which is currently the selection variable
       Cursor myCursor = this.getContentResolver().query(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, projection, selection, null, sort);

       long imageId = 0l;
       long thumbnailImageId = 0l;
       String thumbnailPath = "";

       try{
        myCursor.moveToFirst();
       imageId = myCursor.getLong(myCursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails.IMAGE_ID));
       thumbnailImageId = myCursor.getLong(myCursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID));
       thumbnailPath = myCursor.getString(myCursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA));
       }
       finally{myCursor.close();}

        //Create new Cursor to obtain the file Path for the large image

        String[] largeFileProjection = {
        MediaStore.Images.ImageColumns._ID,
        MediaStore.Images.ImageColumns.DATA
        };

        String largeFileSort = MediaStore.Images.ImageColumns._ID + " DESC";
        myCursor = this.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, largeFileProjection, null, null, largeFileSort);
       String largeImagePath = "";

       try{
        myCursor.moveToFirst();

       //This will actually give you the file path location of the image.
       largeImagePath = myCursor.getString(myCursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATA));
       }
       finally{myCursor.close();}
        // These are the two URI's you'll be interested in. They give you a handle to the actual images
        Uri uriLargeImage = Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, String.valueOf(imageId));
        Uri uriThumbnailImage = Uri.withAppendedPath(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, String.valueOf(thumbnailImageId));

        Intent next= new Intent(this,AddListing.class);

        next.putExtra("imageUriThumb", uriThumbnailImage.toString());
        next.putExtra("imageUriFull", uriLargeImage.toString());

        startActivity(next);

   }

   }

Activity B

String uri = bundle.getString("imageUriThumb");
            Uri myThumbUri = Uri.parse(uri);

            try {
                tempBitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(),myThumbUri);
                imgThumbnail.setImageBitmap(tempBitmap);

                ByteArrayOutputStream bao = new ByteArrayOutputStream();
                tempBitmap.compress(Bitmap.CompressFormat.PNG, 90, bao);

                byte [] ba = bao.toByteArray();
                imageBytesString = Base64.encodeToString(ba, 0);

            } catch (Exception e) {

            } 
  • 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-12T12:03:18+00:00Added an answer on June 12, 2026 at 12:03 pm

    I ended up this problem with following points:

    i have searched this issue on internet already actually these phones dont get images using intent.get(“data”) and that’s why i used above mentioned technique. i have tried this using Samsung ace phone , Samsung Galaxy and same problem is there. i guess whole Samsung dont work perfectly and delayed response is there when you have requirement of taking pictures again and again 🙁 rest of phones like htc works perfect.

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

Sidebar

Related Questions

I am working with facebook-ios-sdk, It working fine But I am facing issue related
Facing some issue in Talend Admin Console, the jobs that are running from IDE
I am facing issue deleting set of records from a table named links_data because
I am facing loading time taking - performance issue due to many linkbuttons in
May there is very simple solution but I am facing issue to solve this
I'm new in android development and am facing issue with my test code .
As an Android developer, I am facing issue with Logcat integration in Eclipse. Most
I get huge xml file from a service, and Im facing some performance issue
I am using cs3pie and facing some issue with it. It's working but instead
Im facing an issue which I believe to be VAO-dependant, but Im not sure..

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.