Reputation: 4441
I have problem with:
android.app.Fragment$InstantiationException: Unable to instantiate fragment ${packageName}.${activityClass}$GeneralPreferenceFragment
The xml layout not working:
<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" />
This works though:
<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" />
Any idea why? Thanks!
Example comes from SettingsActivty when creating a new project from Android Eclipse and it only breaks on a tablet size AVD.
Added this to the AndroidManifest:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>)
Upvotes: 6
Views: 1661
Reputation: 173
It's not working because ${packageName}
and ${activityClass}
should be replaced with your package and activity.
You are doing it right now. Check this example from the documentation.
Upvotes: 7