1

我创建了一个包含 Activity 的 TabActivity 类。

我已经装箱了 Fragment 并在活动中使用了该 Fragment。

一切正常,直到屏幕被锁定。

当屏幕被锁定时,应用程序就会崩溃。

这是堆栈跟踪

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}

请帮我解决这个问题。

我试图在onDestroy()onDetach()方法中打印日志。TabActivity 中的所有 Fragment 都会调用它。

我已经尝试过这个链接,但没有运气。

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

IllegalArgumentException:快速切换 ActionBar 选项卡时没有找到片段 id 的视图

这是bug吗??

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

4

2 回答 2

5

问题已解决。

我不知道这个在这里的作用是什么,但它解决了我的问题并且完美地工作。

android:configChanges="orientation|keyboardHidden|screenSize"

我已经在menifest文件里面写了上面的行activity

现在它的工作完美。

于 2013-09-25T12:13:15.257 回答
0

我的问题通过添加清单解决了:下面的代码:

<activity
            android:name="com.android.Take Activity"
            android:exported="true"
             android:configChanges="orientation|screenSize"
            android:noHistory="true"
            android:screenOrientation="landscape"
            android:windowSoftInputMode="stateHidden" > </activity>
于 2015-08-14T11:54:07.623 回答