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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:08:07+00:00 2026-06-15T15:08:07+00:00

My onCreate(): @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

  • 0

My onCreate():

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


         Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

            imageFile = new File(Environment.getExternalStorageDirectory(),
                    "/image.jpg");

            System.out.println(imageFile +" is the path with extentions");
            outputFileUri = Uri.fromFile(imageFile);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
            startActivityForResult(intent, TAKE_PICTURE);

        setContentView(R.layout.activity_head_size);

System.out.println("OnCreate");
    }

Obviously, that starts the camera and waits for it to finish and return the image. When that finishes, it should call

 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        }

However, after I hit save in the camera, it loads the onCreate and reruns the camera. Then If you retake the image and hit save it goes to the activity; however, doesn’t run the onActivityResult? what is going on?

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            if(resultCode == 1){
            myImage = (ImageView) findViewById(R.id.imageView1);


            myBitmap = BitmapFactory.decodeFile( Environment.getExternalStorageDirectory() +
                   "/image.jpg");



             myBitmap = Bitmap.createScaledBitmap(myBitmap, 256, 256, false);
                myImage.setImageBitmap(myBitmap);

                width = myBitmap.getWidth();
                height = myBitmap.getHeight();


                orig = new int[width*height];

                myBitmap.getPixels(orig, 0, width, 0, 0, width, height);

                System.out.println("ready for processing");
            }
        }
  • 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-15T15:08:08+00:00Added an answer on June 15, 2026 at 3:08 pm

    Use the enum value, instead of just a hard coded int.

    if(resultCode == RESULT_OK){
    

    From the docs, RESULT_OK=-1, and you were looking for 1. Also, I don’t see where you are checking for the requestCode==TAKE_PICTURE, that should be a pre-request as well, to ensure you are responding to the right intent.

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

Sidebar

Related Questions

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.picture_choice_activity); Button takePictureButton = (Button)findViewById(R.id.takePictureButton); takePictureButton.setOnClickListener(new OnClickListener()
public class HMITabActivity extends TabActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final TabHost
m getting exception while taping on listView item.. @Override protected void onCreate(Bundle savedInstanceState) {
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2); savedInstanceState.putString(foo, bar); } @Override public void
I draw an arc using onDraw(canvas) : @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
public class SettingsActivity extends SherlockPreferenceActivity implements OnSharedPreferenceChangeListener, OnPreferenceChangeListener { @SuppressWarnings(deprecation) @Override protected void onCreate(Bundle
I'm creating a new database in my Activity like this: @Override public void onCreate(Bundle
Here is the relevent code: ... Resources res; @Override public void onCreate(Bundle savedInstanceState) {
Here's the code: public class MenuTabActivity extends TabActivity implements OnTabChangeListener{ @Override protected void onCreate(Bundle
@Override public void onCreate(SQLiteDatabase db) { db.execSQL(DATABASE_CREATE); // providers data // db.execSQL(insert into //

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.