You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to build my preferences with preference headers using this lib, but I'm getting the following error when clicking on a header:
2513-2513/org.testing.preferencefragment_test E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: org.testing.preferencefragment_test, PID: 2513
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.testing.preferencefragment_test/org.testing.preferencefragment_test.ApplicationPreferencesActivity}: android.app.Fragment$InstantiationException: Trying to instantiate a class org.testing.preferencefragment_test.ApplicationPreferencesActivity$SettingsFragmentTest that is not a Fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.app.Fragment$InstantiationException: Trying to instantiate a class org.testing.preferencefragment_test.ApplicationPreferencesActivity$SettingsFragmentTest that is not a Fragment
at android.app.Fragment.instantiate(Fragment.java:585)
at android.preference.PreferenceActivity.switchToHeaderInner(PreferenceActivity.java:1183)
at android.preference.PreferenceActivity.switchToHeader(PreferenceActivity.java:1199)
at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:545)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException
at android.app.Fragment.instantiate(Fragment.java:585)
at android.preference.PreferenceActivity.switchToHeaderInner(PreferenceActivity.java:1183)
at android.preference.PreferenceActivity.switchToHeader(PreferenceActivity.java:1199)
at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:545)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
When I replace import android.support.v4.preference.PreferenceFragment; with import android.preference.PreferenceFragment; its working. Could I do anything about it, or is it a bug/missing feature of this library?
The text was updated successfully, but these errors were encountered:
I tried to build my preferences with preference headers using this lib, but I'm getting the following error when clicking on a header:
I created a test-project at: https://github.com/agrajaghh/PreferenceFragment-Test following the guidlines at https://developer.android.com/guide/topics/ui/settings.html#PreferenceHeaders
The
PreferenceActivity
looks like this:with
preference_headers.xml
:and
settings_test.xml
:When I replace
import android.support.v4.preference.PreferenceFragment;
withimport android.preference.PreferenceFragment;
its working. Could I do anything about it, or is it a bug/missing feature of this library?The text was updated successfully, but these errors were encountered: