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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:58:07+00:00 2026-06-06T01:58:07+00:00

I am taking a high resolution picture through the default camera activity(using intent.put Extras

  • 0

I am taking a high resolution picture through the default camera activity(using intent.put Extras),and saving it to the sd card,

Code:

public class CameraActivity extends Activity implements OnClickListener {
    /** Called when the activity is first created. */

    Button takepicture ;
    ImageView iv ;
    TextView tv;
    Button show;

    String filepath;
    Intent i;
    Uri mUri;

    final static int cameraData = 0;

    File folder = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        takepicture = (Button) findViewById(R.id.button1);
        iv = (ImageView) findViewById(R.id.imageView1);
        tv = (TextView) findViewById(R.id.textView1);
        show = (Button) findViewById(R.id.button2);
        takepicture.setOnClickListener(this);
        show.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

        switch(v.getId()){

        case R.id.button1:

            String sdcardstate = android.os.Environment.getExternalStorageState();

            if(sdcardstate.contentEquals(android.os.Environment.MEDIA_MOUNTED)){

                 filepath = Environment.getExternalStorageDirectory().getPath();

                 folder = new File(filepath,"wax");

                 if(!folder.exists()){
                     try {
                        folder.createNewFile();
                         Log.d("folder created", "ya");
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                 }

                 mUri = Uri.fromFile(folder);
                 Log.d("bk", mUri.toString());

                 i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                 i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, mUri);

                 Log.d("extra", "extra");
                 startActivityForResult(i,cameraData);
            }
            break;

        case R.id.button2:

            File f = new File(filepath,"bmp.png");

            Bitmap myBitmap = BitmapFactory.decodeFile(f.getAbsolutePath());              

            iv.setImageBitmap(myBitmap);                
            break;
        }           
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // TODO Auto-generated method stub
        super.onActivityResult(requestCode, resultCode, data);

        if(resultCode==RESULT_OK){

            tv.setText("Result ok");
            Log.d("ok", "ok");
            Bundle extras = data.getExtras();

            Bitmap bmp = (Bitmap) extras.get("data");
        }
    }
}

The camera activity starts , the image is taken , But when i click save , it does not return and force closes.

I have read quite a few threads on this , Learnt that file must be created before the camera activity is started , but still it does not.

Please help , I’m stuck on this problem for a week or so.

Logcat error

06-15 16:05:50.205: W/dalvikvm(1780): threadid=10: thread exiting with uncaught exception (group=0x4001d800)
06-15 16:05:50.205: E/AndroidRuntime(1780): FATAL EXCEPTION: GLThread 12
06-15 16:05:50.205: E/AndroidRuntime(1780): java.lang.IllegalArgumentException: No configs match configSpec
06-15 16:05:50.205: E/AndroidRuntime(1780):     at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:760)
06-15 16:05:50.205: E/AndroidRuntime(1780):     at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:916)
06-15 16:05:50.205: E/AndroidRuntime(1780):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1246)
06-15 16:05:50.205: E/AndroidRuntime(1780):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)
06-15 16:05:50.294: W/ActivityManager(59):   Force finishing activity com.android.camera/.Camera
06-15 16:05:50.444: V/camera(1780): stopPreview
  • 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-06T01:58:10+00:00Added an answer on June 6, 2026 at 1:58 am

    Use following to achieve this.

    Before you call CameraIntent create a file and uri based on that filepath as shown here.

    filename = Environment.getExternalStorageDirectory().getPath() + "/test/testfile.jpg";
    imageUri = Uri.fromFile(new File(filename));
    
    // start default camera
    Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    cameraIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
                    imageUri);
    startActivityForResult (cameraIntent, CAMERA_PIC_REQUEST);
    

    Now, you have the filepath you can use it in onAcityvityResult method as following,

     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if(requestCode != CAMERA_PIC_REQUEST || filename == null)
            return;
        ImageView img = (ImageView) findViewById(R.id.image);
        img.setImageURI(imageUri);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm a high school student taking an iPhone development class. For my final
Taking the jQuery framework for example, if you run code like this: $(document).ready(function init()
When I browse github I have a hard time differentiating high quality code from
We were able to solve a high CPU usage problem by taking advantage of
We look to build a high-performance, scalable Comet server, and thought first about using
We look to build a high-performance, scalable Comet server, and thought first about using
I am a high school student taking cs106a at Stanford via video. For my
I am a high school student taking cs106a at Stanford via video. For my
Okay, so far, I have been taking computer science courses in my high school
My silverlight application is taking up 75 megs of memory. This seems high. How

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.