Preference Activity

walterf25

Expert
Licensed User
Longtime User
Hello All, i'm updating one of my apps, i decided to add a preference activity to let users set some default settings, the app works fine the first time, when i launch the preference activity and select an option from one list and another option from a second list, then let's say i exit the application and then i re-open it the second time i launch the preference activity the app crashes with this error

Starting: Intent { flg=0x20000 cmp=com.genesisitdev.thepiratebay/anywheresoftware.b4a.objects.preferenceactivity (has extras) } from pid 24265


** Activity (main) Pause, UserClosed = false **
Shutting down VM


threadid=1: thread exiting with uncaught exception (group=0x4001a560)
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.genesisitdev.thepiratebay/anywheresoftware.b4a.objects.preferenceactivity}: java.lang.NullPointerException


at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1696)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716)
at android.app.ActivityThread.access$1500(ActivityThread.java:124)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at anywheresoftware.b4a.objects.preferenceactivity$PreferenceScreenWrapper.createPreference(preferenceactivity.java:169)
at anywheresoftware.b4a.objects.preferenceactivity.onCreate(preferenceactivity.java:41)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1660)
... 11 more
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.genesisitdev.thepiratebay/anywheresoftware.b4a.objects.preferenceactivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1696)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716)
at android.app.ActivityThread.access$1500(ActivityThread.java:124)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at anywheresoftware.b4a.objects.preferenceactivity$PreferenceScreenWrapper.createPreference(preferenceactivity.java:169)
at anywheresoftware.b4a.objects.preferenceactivity.onCreate(preferenceactivity.java:41)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1660)
... 11 more
Force finishing activity com.genesisitdev.thepiratebay/anywheresoftware.b4a.objects.preferenceactivity
Force finishing activity com.genesisitdev.thepiratebay/.main
Activity pause timeout for HistoryRecord{40acd8d8 com.genesisitdev.thepiratebay/anywheresoftware.b4a.objects.preferenceactivity}

Any ideas as to why this would be, this is the first time i use this library, and it is possible i may be missing something but i can't pin point exactly what, I have added this line to my manifest file

B4X:
AddApplicationText(<activity android:name="anywheresoftware.b4a.objects.preferenceactivity"/>)

Any help will be appreciated.

Thanks,
Walter
 
Top