Monique7 Posted May 15, 2013 Share Posted May 15, 2013 Hi, My app has an action bar with tabs with 3 fragments (1-list fragment with the list of running processes, 2-battery and memory info, 3-just some text). It works fine, with no errors on the emulator, but on a my phone it starts ok, I go through the tabs several times(I left the phone to go into sleep mode and back and the app still worked) and then it unexpectedly force closes.I'm new to Android and I don't know how to correct these errors, Please help me!Here are the logcat errors and the code for the Battery class: 05-15 07:24:30.809: E/AndroidRuntime(25883): FATAL EXCEPTION: main 05-15 07:24:30.809: E/AndroidRuntime(25883): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.BATTERY_CHANGED flg=0x60000010 (has extras) } in [email protected] 05-15 07:24:30.809: E/AndroidRuntime(25883): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:755) 05-15 07:24:30.809: E/AndroidRuntime(25883): at android.os.Handler.handleCallback(Handler.java:605) 05-15 07:24:30.809: E/AndroidRuntime(25883): at android.os.Handler.dispatchMessage(Handler.java:92) 05-15 07:24:30.809: E/AndroidRuntime(25883): at android.os.Looper.loop(Looper.java:154) 05-15 07:24:30.809: E/AndroidRuntime(25883): at android.app.ActivityThread.main(ActivityThread.java:4624) 05-15 07:24:30.809: E/AndroidRuntime(25883): at java.lang.reflect.Method.invokeNative(Native Method) 05-15 07:24:30.809: E/AndroidRuntime(25883): at java.lang.reflect.Method.invoke(Method.java:511) 05-15 07:24:30.809: E/AndroidRuntime(25883): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809) 05-15 07:24:30.809: E/AndroidRuntime(25883): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576) 05-15 07:24:30.809: E/AndroidRuntime(25883): at dalvik.system.NativeStart.main(Native Method) 05-15 07:24:30.809: E/AndroidRuntime(25883): Caused by: java.lang.NullPointerException 05-15 07:24:30.809: E/AndroidRuntime(25883): at com.example.mytaskmanager.Battery.setare(Battery.java:77) 05-15 07:24:30.809: E/AndroidRuntime(25883): at com.example.mytaskmanager.Battery$1.onReceive(Battery.java:120) 05-15 07:24:30.809: E/AndroidRuntime(25883): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:746) 05-15 07:24:30.809: E/AndroidRuntime(25883): ... 9 more Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.