Hi,

I have an issue with photo taking in Android. The code below works for
all the phones I have, but when I am testing this with a Honeycomb
tablet (HTC Jetstream, in portrait mode), the picture will be taken in
landscape mode, then when it returns to the app, wipe out the view (as
if onCreate is being called again)!

How should I prevent this to happen? The code below is pretty standard
photo taking code. My guess is that the orientation changed is causing
the issue (even though the app is set to Portrait only). Thanks for
any help!

--
Taking photo:

  intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  File file = new File(Environment.getExternalStorageDirectory(),
"camera.jpg");
  intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
  startActivityForResult(intent, R.id.camera);

Set picture in view:

  if (result == Activity.RESULT_OK) {
    File file = new File(Environment.getExternalStorageDirectory(),
"camera.jpg");
    view.setPicture(BitmapFactory.decodeFile(file.toString()));
    file.delete();
  }
  else
    Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show();

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to