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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:06:48+00:00 2026-06-13T10:06:48+00:00

I experienced 2 strange thing when I pressed the shutter button on my CameraActivity

  • 0

I experienced 2 strange thing when I pressed the shutter button on my CameraActivity

  1. On device 2.3 and 4.0 (Galaxy Ace II, Nexus One and Galaxy Nexus),
    it will freeze for about 2 seconds then proceed to nextActivity.

  2. Only Galaxy Ace 2.3.6, it will give me a garbled pixels like the pic
    below during the freezing period of time, but it can give me the correct image later in nextActivity.

garbled pixels

At first I thought something might be wrong or time consuming in my PicutureCallback method, but it seems ok? And I can’t understand why this garbled pixels will show up only on Galaxy Ace.

So will there be a better way to handle the PictureCallback to make it quicker?

There’s no error log, so I just put my related code:

// I call the takePicture in my button listener.
camera.takePicture(null, null, mPicture);

// here's the picture callback
private PictureCallback mPicture = new PictureCallback() {

    @Override
    public void onPictureTaken(byte[] data, Camera camera) {


        new ShutterHandler(data).execute();
    }

    class ShutterHandler extends AsyncTask<Void, Void, Void> {

        Bitmap bm;
        String timeStamp;
        String filename;
        Intent nextIntent = new Intent(CameraActivity.this, nextActivity.class);

        // a tricky way to pass data into the AsyncTask
        public ShutterHandler(byte[] data) {
            bm = BitmapFactory.decodeByteArray(data, 0, data.length);

        }


        @Override
        protected Void doInBackground(Void... params) {
            // simply generate a time stamp as filename
            timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
            filename = timeStamp + ".jpg";
            Uri path;
            try {

                // save file to app's private folder
                FileOutputStream fos = openFileOutput(filename, Context.MODE_PRIVATE);

                bm.compress(Bitmap.CompressFormat.JPEG, 100, fos);              
                // retrieve Uri from the file
                path = Uri.fromFile(getFileStreamPath(filename));

                Log.d("CameraActivity", "file saved to: " + path);
                fos.flush();
                fos.close();

                // launch ShowMarkersActivity
                String pathString = path.getPath();
                nextIntent.putExtra("IMG", pathString);
                nextIntent.putExtra("FileName", filename);
                nextIntent.putExtra("FLAG", true);

            } catch (FileNotFoundException e) {
                Log.d("CameraActivity", "File not found: " + e.getMessage());
            } catch (IOException e) {
                Log.d("CameraActivity", "Error accessing file: " + e.getMessage());
            }
            return null;                        
        }
        protected void onPostExecute(Void v) {
            CameraActivity.this.startActivity(nextIntent);
            finish();
        }

    }
};
  • 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-13T10:06:49+00:00Added an answer on June 13, 2026 at 10:06 am

    If you ask the camera picture callback to return jpeg format, it will all be significantly faster. Still the picture callback is slow on most of the available devices.

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

Sidebar

Related Questions

Have anyone experienced this error, from the Apple's developer console? The strange thing is
I experienced very strange behaviour with a CakePHP site in production. Some views did
Since upgrading to Xcode 3.2.1, I've experienced a strange issue that has really killed
I experienced a strange behavior from Java File file = new File(test.txt); file.reName(new File(test1.txt));
I just noticed a strange thing in MIDP 2.0 API: The HttpConnection class apidocs
This is a bit of a strange one, but I've been struggling for a
I've experienced a LOT of strange behaviours with using WebView in Android and I'm
I'm using Android support library v13. There is a strange thing I couldn't understand.
I experienced a strange behavior for some queryStrings for my secondary tiles. the string
I've experienced rather strange behavior of JSTL forEach tag. I have some bean called

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.