1

I got a problem regarding my app, I have created the camera functionality, but I need that after taking the image, the page should redirect to another activity with having that image.

I have used the following code for camera functionality:

@Override
public void onClick(View v) {
    Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
    startActivityForResult(cameraIntent, CAMERA_REQUEST); 
}
user2428118
  • 7,935
  • 4
  • 45
  • 72
  • 2
    u will need to override onActivityResult method of Activity to redirect user after image Taken from Cam – ρяσѕρєя K Mar 12 '13 at 09:57
  • you have to override onActivity Result method in your Activity, in that you will be provided with the params bundle, requestCode and resultCode. In the bundle.getData() will give you details abt th Image Taken. – Triode Mar 12 '13 at 09:58

2 Answers2

0

Override onActivityResult method:

onActivityResult(int reqCode, int respCode, Intent extra)
{
   if(reqCode == CAMERA_REQUEST && respCode == RESULT_OK)
   {
      //Photo has been taken, redirect the user.
   }
}
gvaish
  • 9,374
  • 3
  • 38
  • 43
0
 public void onActivityResult(int requestCode, int resultCode, Intent intent) {
            super.onActivityResult(requestCode, resultCode, intent);

            switch (requestCode) {
                    case PICK_FROM_CAMERA:
                if (resultCode == Activity.RESULT_OK) {
                    Bitmap bitmapImage = (Bitmap) intent.getExtras().get("data");
//Redirectin to your second activty passing Bitmap Object
                                  Intent intent = new Intent(getApplicationContext(),
                                SecondActivity.class);
                        intent.putExtra("bitmap", bitmapImage);
                        startActivity(intent);
              }
                  }

in SecondActivity.java

Retrieve that Bitmap like

Bitmap bitImage=getIntent().getParcelableExtra("bitmap");
Amit Gupta
  • 8,914
  • 1
  • 25
  • 33