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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:06:42+00:00 2026-06-11T00:06:42+00:00

My camera application is not working.I tried with some existing tutorial examples. But they

  • 0

My camera application is not working.I tried with some existing tutorial examples. But they clearly given code for writing android camera app. I used that code and always im getting following image error.

MyCode:

public class MainActivity extends Activity {
    private static int  PICK_FROM_CAMERA =1;
    ImageView iv;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        iv=(ImageView)findViewById(R.id.imageView);

    Button button=(Button)findViewById(R.id.button1);

    button.setOnClickListener(new OnClickListener(){
        @Override
        public void onClick(View view)
        {
             Intent intent = new Intent();
             intent.putExtra("aspectX", 730);
             intent.putExtra("aspectY", 1115);
             intent.putExtra("outputX", 730);
             intent.putExtra("outputY", 1115);
             intent.setAction("android.media.action.IMAGE_CAPTURE");
        startActivityForResult(intent, PICK_FROM_CAMERA);       
    }
         public void onActivityResult(int requestCode, int resultCode, Intent data) 
            {


            // switch(PICK_FROM_CAMERA)
               // {
             //   case PICK_FROM_CAMERA : if (resultCode == RESULT_OK)
              //  { 

             if(requestCode==PICK_FROM_CAMERA&&resultCode==RESULT_OK){
                    ContentValues values = new ContentValues(); 
                    values.put(Images.Media.TITLE, "title");
                    values.put(Images.Media.BUCKET_ID, "test");
                    values.put(Images.Media.DESCRIPTION, "test Image taken");
                    values.put(Images.Media.MIME_TYPE, "image/jpeg");
                    Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
                    Bitmap photo = (Bitmap) data.getExtras().get("data");

                    //((ImageView)findViewById(R.id.selectedimage)).setImageBitmap(photo);

                    Bitmap theImage=(Bitmap)data.getExtras().get("data");
                    iv.setImageBitmap(theImage);
                    OutputStream outstream;
                    try {
                        outstream = getContentResolver().openOutputStream(uri);
                        photo.compress(Bitmap.CompressFormat.JPEG,100, outstream);
                        outstream.close();
                } catch (FileNotFoundException e) {}
                catch (IOException e){}
            }
           // break;
                }


    });
    }

Logcat:

09-05 12:23:49.307: E/ActivityManager(58): ANR in com.android.camera (com.android.camera/.Camera)
09-05 12:23:49.307: E/ActivityManager(58): Reason: keyDispatchingTimedOut
09-05 12:23:49.307: E/ActivityManager(58): Load: 2.54 / 1.24 / 0.48
09-05 12:23:49.307: E/ActivityManager(58): CPU usage from 39468ms to 30ms ago:
09-05 12:23:49.307: E/ActivityManager(58):   qemud: 54% = 10% user + 43% kernel
09-05 12:23:49.307: E/ActivityManager(58):   system_server: 28% = 24% user + 4% kernel / faults: 1253 minor
09-05 12:23:49.307: E/ActivityManager(58):   mediaserver: 14% = 13% user + 0% kernel / faults: 238 minor 1 major
09-05 12:23:49.307: E/ActivityManager(58):   com.example.kkk: 0% = 0% user + 0% kernel / faults: 443 minor
09-05 12:23:49.307: E/ActivityManager(58):   adbd: 0% = 0% user + 0% kernel
09-05 12:23:49.307: E/ActivityManager(58):   m.android.phone: 0% = 0% user + 0% kernel / faults: 37 minor
09-05 12:23:49.307: E/ActivityManager(58):   ronsoft.openwnn: 0% = 0% user + 0% kernel / faults: 27 minor
09-05 12:23:49.307: E/ActivityManager(58):   d.process.acore: 0% = 0% user + 0% kernel / faults: 12 minor
09-05 12:23:49.307: E/ActivityManager(58):   rild: 0% = 0% user + 0% kernel
09-05 12:23:49.307: E/ActivityManager(58):   id.defcontainer: 0% = 0% user + 0% kernel / faults: 19 minor
09-05 12:23:49.307: E/ActivityManager(58):   logcat: 0% = 0% user + 0% kernel
09-05 12:23:49.307: E/ActivityManager(58):   pdflush: 0% = 0% user + 0% kernel
09-05 12:23:49.307: E/ActivityManager(58):   zygote: 0% = 0% user + 0% kernel / faults: 33 minor
09-05 12:23:49.307: E/ActivityManager(58):   ndroid.settings: 0% = 0% user + 0% kernel / faults: 27 minor
09-05 12:23:49.307: E/ActivityManager(58):   roid.alarmclock: 0% = 0% user + 0% kernel / faults: 8 minor
09-05 12:23:49.307: E/ActivityManager(58):   m.android.music: 0% = 0% user + 0% kernel / faults: 25 minor
09-05 12:23:49.307: E/ActivityManager(58):   com.svox.pico: 0% = 0% user + 0% kernel / faults: 29 minor
09-05 12:23:49.307: E/ActivityManager(58):  +.android.camera: 0% = 0% user + 0% kernel
09-05 12:23:49.307: E/ActivityManager(58): TOTAL: 99% = 49% user + 50% kernel + 0% irq + 0% softirq
09-05 12:23:49.727: D/dalvikvm(58): GC_FOR_MALLOC freed 1794 objects / 145104 bytes in 370ms
09-05 12:23:49.757: W/WindowManager(58): No window to dispatch pointer action 1
09-05 12:23:49.847: I/dalvikvm(217): threadid=3: reacting to signal 3
09-05 12:23:50.207: D/dalvikvm(58): GC_FOR_MALLOC freed 164 objects / 148312 bytes in 421ms
09-05 12:23:50.447: I/dalvikvm(162): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:50.657: D/dalvikvm(58): GC_FOR_MALLOC freed 52 objects / 108088 bytes in 395ms
09-05 12:23:50.757: W/WindowManager(58): No window to dispatch pointer action 1
09-05 12:23:50.757: W/WindowManager(58): No window to dispatch pointer action 0
09-05 12:23:50.757: W/WindowManager(58): No window to dispatch pointer action 1
09-05 12:23:50.767: W/WindowManager(58): No window to dispatch pointer action 0
09-05 12:23:50.767: W/WindowManager(58): No window to dispatch pointer action 1
09-05 12:23:50.767: W/WindowManager(58): No window to dispatch pointer action 0
09-05 12:23:50.777: W/WindowManager(58): No window to dispatch pointer action 1
09-05 12:23:50.777: W/WindowManager(58): No window to dispatch pointer action 0
09-05 12:23:50.777: W/WindowManager(58): No window to dispatch pointer action 1
09-05 12:23:51.307: I/ARMAssembler(58): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x323c90:0x323d4c] in 580143 ns
09-05 12:23:52.127: I/dalvikvm(168): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:52.718: I/dalvikvm(243): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:55.188: I/dalvikvm(183): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:55.308: I/dalvikvm(191): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:55.398: I/dalvikvm(130): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:55.538: I/dalvikvm(228): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:55.608: I/dalvikvm(125): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:55.898: I/dalvikvm(217): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:55.980: I/dalvikvm(198): Wrote stack traces to '/data/anr/traces.txt'
09-05 12:23:58.777: W/ActivityManager(58):   Force finishing activity com.android.camera/.Camera
09-05 12:23:58.777: I/ActivityManager(58): Killing com.android.camera (pid=283): user's request
09-05 12:23:58.817: I/Process(58): Sending signal. PID: 283 SIG: 9
09-05 12:23:58.848: I/WindowManager(58): WIN DEATH: Window{43ffffb0 com.android.camera/com.android.camera.Camera paused=true}
09-05 12:23:58.848: I/WindowManager(58): WIN DEATH: Window{43fad698 SurfaceView paused=false}
09-05 12:23:58.887: I/ActivityManager(58): Process com.android.camera (pid 283) has died.
09-05 12:23:58.957: I/WindowManager(58): Setting rotation to 0, animFlags=1
09-05 12:23:58.977: E/CameraService(33): getClientFromCookie: client appears to have died
09-05 12:23:59.007: I/ActivityManager(58): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=1/1 orien=1 layout=18 uiMode=17 seq=5}
09-05 12:23:59.447: W/InputManagerService(58): Got RemoteException sending setActive(false) notification to pid 283 uid 10006
09-05 12:24:01.827: D/dalvikvm(58): GC_EXPLICIT freed 1171 objects / 270992 bytes in 138ms
  • 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-11T00:06:44+00:00Added an answer on June 11, 2026 at 12:06 am

    Try to pass this inside your intent().

    Intent intent =  new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    

    And put this in your menifest

    <uses-permission android:name="android.permission.CAMERA" />
    
        <uses-feature android:name="android.hardware.camera" />
        <uses-feature android:name="android.hardware.camera.autofocus" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My iphoneos 3.1 based application is not working on iOS 4 GM: the camera
I'm referring to the camera application that is already installed on my G1, not
I'm working on a security camera application using the webcam that takes a photo
I'm currently writing a application that needs to capture some images. I start the
I'm writing an application that allows users to upload photos from their camera roll
I'm working on an iPhone application that involves uploading full photos from the camera
Am working on some application. However, i have finished two modules which invoke the
I'm writing a desktop (J2SE) application that will take photographs with a digital camera.
I am working now on application that start the camera and take a photo,
I implemented the application for getting image from the camera album in sdcard.But it

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.