我有问题:
android.app.Fragment$InstantiationException: Unable to instantiate fragment ${packageName}.${activityClass}$GeneralPreferenceFragment
xml布局不起作用:
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- These settings headers are only used on tablets. -->
<header
android:fragment="${packageName}.${activityClass}$GeneralPreferenceFragment"
android:title="@string/pref_header_general" />
这虽然有效:
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- These settings headers are only used on tablets. -->
<header
android:fragment="com.example.b.SettingsActivity$GeneralPreferenceFragment"
android:title="@string/pref_header_general" />
知道为什么吗?谢谢!
示例来自从 Android Eclipse 创建新项目时的 SettingsActivty,它仅在平板电脑大小的 AVD 上中断。
将此添加到 AndroidManifest:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>)