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>)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With