androidandroid-fragmentsfragmenttabactivity

Application getting crashed when screen locked in Fragment


I have created a TabActivity class which contains Activity.

I have crated Fragments and using that Fragment inside the activity.

Everything is working perfect until the screen gets locked.

When the screen gets locked, then the app crashes.

This is the stack trace

09-25 15:54:36.306: 
E/AndroidRuntime(21443): java.lang.IllegalArgumentException: 
No view found for id 0x7f09003d (...id/linearLayoutSC) for fragment SubCategoryGrid{42bbaf70 #7 id=0x7f09003d subCatList}

Please help me to resolve this issue.

I have tried to print the log in onDestroy() and onDetach() method. It gets called for all the Fragment in a TabActivity.

I have tried this links but not luck with that.

https://stackoverflow.com/a/9446326/1395259

IllegalArgumentException: No view found for id for fragment when fast switching ActionBar Tabs

Is this the bug??

https://code.google.com/p/android/issues/detail?id=19211


Solution

  • The issue is resolved.

    I dont know what is the role of this here, but it solved my issue and working perfectly.

    android:configChanges="orientation|keyboardHidden|screenSize"
    

    I have written the above line in the menifest file inside activity

    Now its working perfect.