0

Possible Duplicate:
Calling camera app recreates android activity

I am creating a tabbed activity in android.Inside one of the activities within a tab I launch the camera app using startActivityForResult(). After returning from camera my tabhost is recreated. So I am taken back to the initial screen of the tab.

I have added this line for tabhost and all the activities of the tab. But still the same.

android:configChanges="orientation|keyboardHidden"

How can I prevent tabhost reloading/recreation?

Thanks

Community
  • 1
  • 1
Zach
  • 9,989
  • 19
  • 70
  • 107
  • You can get back to your tab by tabHost.setCurrentTab(id); but my guess that you are finishing your activity after you start the camera activity, am I right? if so, do not. – Kirill Kulakov Nov 11 '12 at 21:56
  • You can't. Every Android app should deal with an activity being destroyed and recreated. Save state in onPause() and restore it in onResume() including what tab is selected. – Simon Nov 11 '12 at 21:56
  • @Simon Issue for me is onActivityResult will have a null data when its getting called. Is there any solution for that? Will your suggestion resolve my issue? Can you provide any sample code to do this please. – Zach Nov 11 '12 at 22:04
  • @KirillKulakov no I am not calling finish. I can see this happens only on s3. On s3 when camera app starts its changing the orientation to landscape and back. is that the reason for my error? – Zach Nov 11 '12 at 22:08

0 Answers0