0

Im making an app that takes a photo from camera intent and places it to the activity, I followed the example on google developers.

The problem is when I launch the camera intent if I change camera orientation, one time I save the photo it returns a "Unable to resume Activity" or "Unable to Start activity component info"

I followed the camera example on android developers, but it only shows how to prevent lost the image one time placed in the activity and change the orientation.

I tried add the following with no luck

@Override
protected void onSaveInstanceState(Bundle outState){
  outState.putParcelable(URI_SAVED, selectedImageUri);
  super.onSaveInstanceState(outState);
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState){
  super.onRestoreInstanceState(savedInstanceState);
  Uri new_uri = savedInstanceState.getParcelable(URI_SAVED);
  selectedImagePath = getPath(new_uri).toString();
  Img.setImageURI(new_uri);
}

You know where I can fnd a good working example of this ? thx

Nonyck
  • 652
  • 1
  • 12
  • 28

1 Answers1

0

The problem can be fixed by using getOptimalPreviewSize() function and surfaceChanged()

  • and how you get the URI in that example I couldn't – Nonyck Aug 21 '12 at 18:22
  • i never used that , but if iam not wrong , you have complete example of that what you loking for , you can download that sample via SDK Manager , i think its called CameraPreview or something like that –  Aug 21 '12 at 18:29
  • Yea but each time I try to retrieve the uri from the img it places the activity crashes – Nonyck Aug 21 '12 at 18:52