this is the follow up question to this one
I get the following stack logcat parcel read ecception why do I get this
10-09 10:27:27.993: I/dalvikvm(825): threadid=3: reacting to signal 3
10-09 10:27:28.093: I/dalvikvm(825): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:27:28.422: D/gralloc_goldfish(825): Emulator without GPU emulation detected.
10-09 10:28:45.692: W/ActivityThread(872): Application com.example.sms is waiting for the debugger on port 8100...
10-09 10:28:45.793: I/System.out(872): Sending WAIT chunk
10-09 10:28:45.813: I/dalvikvm(872): Debugger is active
10-09 10:28:45.833: I/System.out(872): Debugger has connected
10-09 10:28:45.853: I/System.out(872): waiting for debugger to settle...
10-09 10:28:46.063: I/System.out(872): waiting for debugger to settle...
10-09 10:28:46.263: I/System.out(872): waiting for debugger to settle...
10-09 10:28:46.273: I/dalvikvm(872): threadid=3: reacting to signal 3
10-09 10:28:46.312: I/dalvikvm(872): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:28:46.462: I/System.out(872): waiting for debugger to settle...
10-09 10:28:46.662: I/System.out(872): waiting for debugger to settle...
10-09 10:28:46.783: I/dalvikvm(872): threadid=3: reacting to signal 3
10-09 10:28:46.793: I/dalvikvm(872): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:28:46.863: I/System.out(872): waiting for debugger to settle...
10-09 10:28:47.072: I/System.out(872): waiting for debugger to settle...
10-09 10:28:47.263: I/dalvikvm(872): threadid=3: reacting to signal 3
10-09 10:28:47.293: I/System.out(872): waiting for debugger to settle...
10-09 10:28:47.293: I/dalvikvm(872): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:28:47.492: I/System.out(872): waiting for debugger to settle...
10-09 10:28:47.692: I/System.out(872): waiting for debugger to settle...
10-09 10:28:47.763: I/dalvikvm(872): threadid=3: reacting to signal 3
10-09 10:28:47.773: I/dalvikvm(872): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:28:47.893: I/System.out(872): waiting for debugger to settle...
10-09 10:28:48.100: I/System.out(872): debugger has settled (1441)
10-09 10:28:48.273: I/dalvikvm(872): threadid=3: reacting to signal 3
10-09 10:28:48.402: I/dalvikvm(872): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:28:48.773: I/dalvikvm(872): threadid=3: reacting to signal 3
10-09 10:28:48.813: I/dalvikvm(872): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:28:49.213: D/gralloc_goldfish(872): Emulator without GPU emulation detected.
10-09 10:28:49.282: I/dalvikvm(872): threadid=3: reacting to signal 3
10-09 10:28:49.322: I/dalvikvm(872): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:29:00.063: D/AndroidRuntime(872): Shutting down VM
10-09 10:29:00.063: W/dalvikvm(872): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
10-09 10:29:00.203: E/AndroidRuntime(872): FATAL EXCEPTION: main
10-09 10:29:00.203: E/AndroidRuntime(872): java.lang.NullPointerException
10-09 10:29:00.203: E/AndroidRuntime(872): at android.os.Parcel.readException(Parcel.java:1333)
10-09 10:29:00.203: E/AndroidRuntime(872): at android.os.Parcel.readException(Parcel.java:1281)
10-09 10:29:00.203: E/AndroidRuntime(872): at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:413)
10-09 10:29:00.203: E/AndroidRuntime(872): at android.telephony.SmsManager.sendTextMessage(SmsManager.java:87)
10-09 10:29:00.203: E/AndroidRuntime(872): at com.example.sms.SendSMSActivity.sendSMS(SendSMSActivity.java:134)
10-09 10:29:00.203: E/AndroidRuntime(872): at com.example.sms.SendSMSActivity.access$0(SendSMSActivity.java:74)
10-09 10:29:00.203: E/AndroidRuntime(872): at com.example.sms.SendSMSActivity$1.onClick(SendSMSActivity.java:59)
10-09 10:29:00.203: E/AndroidRuntime(872): at android.view.View.performClick(View.java:3511)
10-09 10:29:00.203: E/AndroidRuntime(872): at android.view.View$PerformClick.run(View.java:14105)
10-09 10:29:00.203: E/AndroidRuntime(872): at android.os.Handler.handleCallback(Handler.java:605)
10-09 10:29:00.203: E/AndroidRuntime(872): at android.os.Handler.dispatchMessage(Handler.java:92)
10-09 10:29:00.203: E/AndroidRuntime(872): at android.os.Looper.loop(Looper.java:137)
10-09 10:29:00.203: E/AndroidRuntime(872): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-09 10:29:00.203: E/AndroidRuntime(872): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 10:29:00.203: E/AndroidRuntime(872): at java.lang.reflect.Method.invoke(Method.java:511)
10-09 10:29:00.203: E/AndroidRuntime(872): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-09 10:29:00.203: E/AndroidRuntime(872): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-09 10:29:00.203: E/AndroidRuntime(872): at dalvik.system.NativeStart.main(Native Method)
10-09 10:29:00.803: I/dalvikvm(872): threadid=3: reacting to signal 3
10-09 10:29:00.823: I/dalvikvm(872): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:29:48.632: I/dalvikvm(920): threadid=3: reacting to signal 3
10-09 10:29:48.793: I/dalvikvm(920): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:29:49.133: I/dalvikvm(920): threadid=3: reacting to signal 3
10-09 10:29:49.173: I/dalvikvm(920): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:29:49.203: D/gralloc_goldfish(920): Emulator without GPU emulation detected.
10-09 10:30:34.003: W/ActivityThread(960): Application com.example.sms is waiting for the debugger on port 8100...
10-09 10:30:34.093: I/System.out(960): Sending WAIT chunk
10-09 10:30:34.103: I/dalvikvm(960): Debugger is active
10-09 10:30:34.113: I/System.out(960): Debugger has connected
10-09 10:30:34.163: I/System.out(960): waiting for debugger to settle...
10-09 10:30:34.362: I/System.out(960): waiting for debugger to settle...
10-09 10:30:34.432: I/dalvikvm(960): threadid=3: reacting to signal 3
10-09 10:30:34.442: I/dalvikvm(960): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:30:34.562: I/System.out(960): waiting for debugger to settle...
10-09 10:30:34.763: I/System.out(960): waiting for debugger to settle...
10-09 10:30:34.923: I/dalvikvm(960): threadid=3: reacting to signal 3
10-09 10:30:34.933: I/dalvikvm(960): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:30:34.963: I/System.out(960): waiting for debugger to settle...
10-09 10:30:35.170: I/System.out(960): waiting for debugger to settle...
10-09 10:30:35.371: I/System.out(960): waiting for debugger to settle...
10-09 10:30:35.442: I/dalvikvm(960): threadid=3: reacting to signal 3
10-09 10:30:35.462: I/dalvikvm(960): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:30:35.573: I/System.out(960): waiting for debugger to settle...
10-09 10:30:35.773: I/System.out(960): waiting for debugger to settle...
10-09 10:30:35.953: I/dalvikvm(960): threadid=3: reacting to signal 3
10-09 10:30:36.013: I/System.out(960): waiting for debugger to settle...
10-09 10:30:36.013: I/dalvikvm(960): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:30:36.215: I/System.out(960): debugger has settled (1432)
10-09 10:30:36.452: I/dalvikvm(960): threadid=3: reacting to signal 3
10-09 10:30:36.582: I/dalvikvm(960): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:30:36.953: I/dalvikvm(960): threadid=3: reacting to signal 3
10-09 10:30:36.983: I/dalvikvm(960): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:30:37.462: I/dalvikvm(960): threadid=3: reacting to signal 3
10-09 10:30:37.472: I/dalvikvm(960): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:30:37.502: D/gralloc_goldfish(960): Emulator without GPU emulation detected.
10-09 10:31:08.195: D/AndroidRuntime(960): Shutting down VM
10-09 10:31:08.195: W/dalvikvm(960): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
10-09 10:31:08.292: E/AndroidRuntime(960): FATAL EXCEPTION: main
10-09 10:31:08.292: E/AndroidRuntime(960): java.lang.NullPointerException
10-09 10:31:08.292: E/AndroidRuntime(960): at android.os.Parcel.readException(Parcel.java:1333)
10-09 10:31:08.292: E/AndroidRuntime(960): at android.os.Parcel.readException(Parcel.java:1281)
10-09 10:31:08.292: E/AndroidRuntime(960): at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:413)
10-09 10:31:08.292: E/AndroidRuntime(960): at android.telephony.SmsManager.sendTextMessage(SmsManager.java:87)
10-09 10:31:08.292: E/AndroidRuntime(960): at com.example.sms.SendSMSActivity.sendSMS(SendSMSActivity.java:134)
10-09 10:31:08.292: E/AndroidRuntime(960): at com.example.sms.SendSMSActivity.access$0(SendSMSActivity.java:74)
10-09 10:31:08.292: E/AndroidRuntime(960): at com.example.sms.SendSMSActivity$1.onClick(SendSMSActivity.java:57)
10-09 10:31:08.292: E/AndroidRuntime(960): at android.view.View.performClick(View.java:3511)
10-09 10:31:08.292: E/AndroidRuntime(960): at android.view.View$PerformClick.run(View.java:14105)
10-09 10:31:08.292: E/AndroidRuntime(960): at android.os.Handler.handleCallback(Handler.java:605)
10-09 10:31:08.292: E/AndroidRuntime(960): at android.os.Handler.dispatchMessage(Handler.java:92)
10-09 10:31:08.292: E/AndroidRuntime(960): at android.os.Looper.loop(Looper.java:137)
10-09 10:31:08.292: E/AndroidRuntime(960): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-09 10:31:08.292: E/AndroidRuntime(960): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 10:31:08.292: E/AndroidRuntime(960): at java.lang.reflect.Method.invoke(Method.java:511)
10-09 10:31:08.292: E/AndroidRuntime(960): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-09 10:31:08.292: E/AndroidRuntime(960): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-09 10:31:08.292: E/AndroidRuntime(960): at dalvik.system.NativeStart.main(Native Method)
10-09 10:31:08.913: I/dalvikvm(960): threadid=3: reacting to signal 3
10-09 10:31:08.923: I/dalvikvm(960): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:31:11.983: I/Process(960): Sending signal. PID: 960 SIG: 9
10-09 10:31:28.392: I/dalvikvm(1008): threadid=3: reacting to signal 3
10-09 10:31:28.492: I/dalvikvm(1008): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:31:28.843: D/gralloc_goldfish(1008): Emulator without GPU emulation detected.
10-09 10:31:32.713: D/AndroidRuntime(1008): Shutting down VM
10-09 10:31:32.713: W/dalvikvm(1008): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
10-09 10:31:32.803: E/AndroidRuntime(1008): FATAL EXCEPTION: main
10-09 10:31:32.803: E/AndroidRuntime(1008): java.lang.NullPointerException
10-09 10:31:32.803: E/AndroidRuntime(1008): at android.os.Parcel.readException(Parcel.java:1333)
10-09 10:31:32.803: E/AndroidRuntime(1008): at android.os.Parcel.readException(Parcel.java:1281)
10-09 10:31:32.803: E/AndroidRuntime(1008): at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:413)
10-09 10:31:32.803: E/AndroidRuntime(1008): at android.telephony.SmsManager.sendTextMessage(SmsManager.java:87)
10-09 10:31:32.803: E/AndroidRuntime(1008): at com.example.sms.SendSMSActivity.sendSMS(SendSMSActivity.java:134)
10-09 10:31:32.803: E/AndroidRuntime(1008): at com.example.sms.SendSMSActivity.access$0(SendSMSActivity.java:74)
10-09 10:31:32.803: E/AndroidRuntime(1008): at com.example.sms.SendSMSActivity$1.onClick(SendSMSActivity.java:57)
10-09 10:31:32.803: E/AndroidRuntime(1008): at android.view.View.performClick(View.java:3511)
10-09 10:31:32.803: E/AndroidRuntime(1008): at android.view.View$PerformClick.run(View.java:14105)
10-09 10:31:32.803: E/AndroidRuntime(1008): at android.os.Handler.handleCallback(Handler.java:605)
10-09 10:31:32.803: E/AndroidRuntime(1008): at android.os.Handler.dispatchMessage(Handler.java:92)
10-09 10:31:32.803: E/AndroidRuntime(1008): at android.os.Looper.loop(Looper.java:137)
10-09 10:31:32.803: E/AndroidRuntime(1008): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-09 10:31:32.803: E/AndroidRuntime(1008): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 10:31:32.803: E/AndroidRuntime(1008): at java.lang.reflect.Method.invoke(Method.java:511)
10-09 10:31:32.803: E/AndroidRuntime(1008): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-09 10:31:32.803: E/AndroidRuntime(1008): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-09 10:31:32.803: E/AndroidRuntime(1008): at dalvik.system.NativeStart.main(Native Method)
10-09 10:31:33.392: I/dalvikvm(1008): threadid=3: reacting to signal 3
10-09 10:31:33.402: I/dalvikvm(1008): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:32:10.452: I/dalvikvm(1055): threadid=3: reacting to signal 3
10-09 10:32:10.523: I/dalvikvm(1055): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:32:10.923: D/gralloc_goldfish(1055): Emulator without GPU emulation detected.
10-09 10:32:10.953: I/dalvikvm(1055): threadid=3: reacting to signal 3
10-09 10:32:10.973: I/dalvikvm(1055): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:35:10.863: D/AndroidRuntime(1055): Shutting down VM
10-09 10:35:10.863: W/dalvikvm(1055): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
10-09 10:35:10.883: E/AndroidRuntime(1055): FATAL EXCEPTION: main
10-09 10:35:10.883: E/AndroidRuntime(1055): java.lang.NullPointerException
10-09 10:35:10.883: E/AndroidRuntime(1055): at android.os.Parcel.readException(Parcel.java:1333)
10-09 10:35:10.883: E/AndroidRuntime(1055): at android.os.Parcel.readException(Parcel.java:1281)
10-09 10:35:10.883: E/AndroidRuntime(1055): at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:413)
10-09 10:35:10.883: E/AndroidRuntime(1055): at android.telephony.SmsManager.sendTextMessage(SmsManager.java:87)
10-09 10:35:10.883: E/AndroidRuntime(1055): at com.example.sms.SendSMSActivity.sendSMS(SendSMSActivity.java:132)
10-09 10:35:10.883: E/AndroidRuntime(1055): at com.example.sms.SendSMSActivity.access$0(SendSMSActivity.java:72)
10-09 10:35:10.883: E/AndroidRuntime(1055): at com.example.sms.SendSMSActivity$1.onClick(SendSMSActivity.java:57)
10-09 10:35:10.883: E/AndroidRuntime(1055): at android.view.View.performClick(View.java:3511)
10-09 10:35:10.883: E/AndroidRuntime(1055): at android.view.View$PerformClick.run(View.java:14105)
10-09 10:35:10.883: E/AndroidRuntime(1055): at android.os.Handler.handleCallback(Handler.java:605)
10-09 10:35:10.883: E/AndroidRuntime(1055): at android.os.Handler.dispatchMessage(Handler.java:92)
10-09 10:35:10.883: E/AndroidRuntime(1055): at android.os.Looper.loop(Looper.java:137)
10-09 10:35:10.883: E/AndroidRuntime(1055): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-09 10:35:10.883: E/AndroidRuntime(1055): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 10:35:10.883: E/AndroidRuntime(1055): at java.lang.reflect.Method.invoke(Method.java:511)
10-09 10:35:10.883: E/AndroidRuntime(1055): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-09 10:35:10.883: E/AndroidRuntime(1055): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-09 10:35:10.883: E/AndroidRuntime(1055): at dalvik.system.NativeStart.main(Native Method)
10-09 10:35:11.453: I/dalvikvm(1055): threadid=3: reacting to signal 3
10-09 10:35:11.473: I/dalvikvm(1055): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:35:50.673: I/dalvikvm(1104): threadid=3: reacting to signal 3
10-09 10:35:50.803: I/dalvikvm(1104): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:35:51.112: D/gralloc_goldfish(1104): Emulator without GPU emulation detected.
10-09 10:35:51.142: I/dalvikvm(1104): threadid=3: reacting to signal 3
10-09 10:35:51.182: I/dalvikvm(1104): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:37:12.383: D/AndroidRuntime(1104): Shutting down VM
10-09 10:37:12.383: W/dalvikvm(1104): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
10-09 10:37:12.403: E/AndroidRuntime(1104): FATAL EXCEPTION: main
10-09 10:37:12.403: E/AndroidRuntime(1104): java.lang.NullPointerException
10-09 10:37:12.403: E/AndroidRuntime(1104): at android.os.Parcel.readException(Parcel.java:1333)
10-09 10:37:12.403: E/AndroidRuntime(1104): at android.os.Parcel.readException(Parcel.java:1281)
10-09 10:37:12.403: E/AndroidRuntime(1104): at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:413)
10-09 10:37:12.403: E/AndroidRuntime(1104): at android.telephony.SmsManager.sendTextMessage(SmsManager.java:87)
10-09 10:37:12.403: E/AndroidRuntime(1104): at com.example.sms.SendSMSActivity.sendSMS(SendSMSActivity.java:132)
10-09 10:37:12.403: E/AndroidRuntime(1104): at com.example.sms.SendSMSActivity.access$0(SendSMSActivity.java:72)
10-09 10:37:12.403: E/AndroidRuntime(1104): at com.example.sms.SendSMSActivity$1.onClick(SendSMSActivity.java:57)
10-09 10:37:12.403: E/AndroidRuntime(1104): at android.view.View.performClick(View.java:3511)
10-09 10:37:12.403: E/AndroidRuntime(1104): at android.view.View$PerformClick.run(View.java:14105)
10-09 10:37:12.403: E/AndroidRuntime(1104): at android.os.Handler.handleCallback(Handler.java:605)
10-09 10:37:12.403: E/AndroidRuntime(1104): at android.os.Handler.dispatchMessage(Handler.java:92)
10-09 10:37:12.403: E/AndroidRuntime(1104): at android.os.Looper.loop(Looper.java:137)
10-09 10:37:12.403: E/AndroidRuntime(1104): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-09 10:37:12.403: E/AndroidRuntime(1104): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 10:37:12.403: E/AndroidRuntime(1104): at java.lang.reflect.Method.invoke(Method.java:511)
10-09 10:37:12.403: E/AndroidRuntime(1104): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-09 10:37:12.403: E/AndroidRuntime(1104): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-09 10:37:12.403: E/AndroidRuntime(1104): at dalvik.system.NativeStart.main(Native Method)
10-09 10:37:12.992: I/dalvikvm(1104): threadid=3: reacting to signal 3
10-09 10:37:13.012: I/dalvikvm(1104): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:37:24.783: I/dalvikvm(1169): threadid=3: reacting to signal 3
10-09 10:37:24.882: I/dalvikvm(1169): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:37:25.283: I/dalvikvm(1169): threadid=3: reacting to signal 3
10-09 10:37:25.303: I/dalvikvm(1169): Wrote stack traces to '/data/anr/traces.txt'
10-09 10:37:25.503: D/gralloc_goldfish(1169): Emulator without GPU emulation detected.
10-09 10:37:34.952: W/IInputConnectionWrapper(1169): showStatusIcon on inactive InputConnection
10-09 10:37:45.533: D/AndroidRuntime(1169): Shutting down VM
10-09 10:37:45.533: W/dalvikvm(1169): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
10-09 10:37:45.563: E/AndroidRuntime(1169): FATAL EXCEPTION: main
10-09 10:37:45.563: E/AndroidRuntime(1169): java.lang.NullPointerException
10-09 10:37:45.563: E/AndroidRuntime(1169): at android.os.Parcel.readException(Parcel.java:1333)
10-09 10:37:45.563: E/AndroidRuntime(1169): at android.os.Parcel.readException(Parcel.java:1281)
10-09 10:37:45.563: E/AndroidRuntime(1169): at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:413)
10-09 10:37:45.563: E/AndroidRuntime(1169): at android.telephony.SmsManager.sendTextMessage(SmsManager.java:87)
10-09 10:37:45.563: E/AndroidRuntime(1169): at com.example.sms.SendSMSActivity.sendSMS(SendSMSActivity.java:132)
10-09 10:37:45.563: E/AndroidRuntime(1169): at com.example.sms.SendSMSActivity.access$0(SendSMSActivity.java:72)
10-09 10:37:45.563: E/AndroidRuntime(1169): at com.example.sms.SendSMSActivity$1.onClick(SendSMSActivity.java:57)
10-09 10:37:45.563: E/AndroidRuntime(1169): at android.view.View.performClick(View.java:3511)
10-09 10:37:45.563: E/AndroidRuntime(1169): at android.view.View$PerformClick.run(View.java:14105)
10-09 10:37:45.563: E/AndroidRuntime(1169): at android.os.Handler.handleCallback(Handler.java:605)
10-09 10:37:45.563: E/AndroidRuntime(1169): at android.os.Handler.dispatchMessage(Handler.java:92)
10-09 10:37:45.563: E/AndroidRuntime(1169): at android.os.Looper.loop(Looper.java:137)
10-09 10:37:45.563: E/AndroidRuntime(1169): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-09 10:37:45.563: E/AndroidRuntime(1169): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 10:37:45.563: E/AndroidRuntime(1169): at java.lang.reflect.Method.invoke(Method.java:511)
10-09 10:37:45.563: E/AndroidRuntime(1169): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-09 10:37:45.563: E/AndroidRuntime(1169): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-09 10:37:45.563: E/AndroidRuntime(1169): at dalvik.system.NativeStart.main(Native Method)
10-09 10:37:46.122: I/dalvikvm(1169): threadid=3: reacting to signal 3
10-09 10:37:46.142: I/dalvikvm(1169): Wrote stack traces to '/data/anr/traces.txt'
smsactivity
public class SendSMSActivity extends Activity {
Button btnSendSMS;
EditText txtPhoneNo;
EditText txtMessage;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
txtPhoneNo = (EditText) findViewById(R.id.txtPhoneNo);
txtMessage = (EditText) findViewById(R.id.txtMessage);
btnSendSMS.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String phoneNo = txtPhoneNo.getText().toString();
String message = txtMessage.getText().toString();
if (phoneNo.length() > 0 && message.length() > 0)
{
TelephonyManager telMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
int simState = telMgr.getSimState();
switch (simState) {
case TelephonyManager.SIM_STATE_ABSENT:
Toast.makeText(getBaseContext(), "No Sim Card found",
Toast.LENGTH_SHORT).show();
break;
case TelephonyManager.SIM_STATE_NETWORK_LOCKED:
// do something
break;
case TelephonyManager.SIM_STATE_PIN_REQUIRED:
// do something
break;
case TelephonyManager.SIM_STATE_PUK_REQUIRED:
// do something
break;
case TelephonyManager.SIM_STATE_READY:
sendSMS(phoneNo, message); // method to send message
break;
case TelephonyManager.SIM_STATE_UNKNOWN:
// do something
break;
}
} else
Toast.makeText(getBaseContext(),
"Please enter both phone number and message.",
Toast.LENGTH_SHORT).show();
}
private void sendSMS(String phoneNumber, String message) {
String SENT = "SMS_SENT";
String DELIVERED = "SMS_DELIVERED";
PendingIntent sentPI = PendingIntent.getBroadcast(
SendSMSActivity.this, 0, new Intent(SENT), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(
SendSMSActivity.this, 0, new Intent(DELIVERED), 0);
// ---when the SMS has been sent---final String string =
// "deprecation";
registerReceiver(new BroadcastReceiver() {
#Override
public void onReceive(Context arg0, Intent arg1) {
switch (getResultCode()) {
case Activity.RESULT_OK:
Toast.makeText(SendSMSActivity.this, "SMS sent",
Toast.LENGTH_SHORT).show();
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
Toast.makeText(SendSMSActivity.this,
"Generic failure", Toast.LENGTH_SHORT)
.show();
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
Toast.makeText(SendSMSActivity.this, "No service",
Toast.LENGTH_SHORT).show();
break;
case SmsManager.RESULT_ERROR_NULL_PDU:
Toast.makeText(SendSMSActivity.this, "Null PDU",
Toast.LENGTH_SHORT).show();
break;
case SmsManager.RESULT_ERROR_RADIO_OFF:
Toast.makeText(getBaseContext(), "Radio off",
Toast.LENGTH_SHORT).show();
break;
}
}
}, new IntentFilter(SENT));
// ---when the SMS has been delivered---
registerReceiver(new BroadcastReceiver() {
#Override
public void onReceive(Context arg0, Intent arg1) {
switch (getResultCode()) {
case Activity.RESULT_OK:
Toast.makeText(SendSMSActivity.this,
"SMS delivered", Toast.LENGTH_SHORT).show();
break;
case Activity.RESULT_CANCELED:
Toast.makeText(SendSMSActivity.this,
"SMS not delivered", Toast.LENGTH_SHORT)
.show();
break;
}
}
}, new IntentFilter(DELIVERED));
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, sentPI,
deliveredPI);
}
});
}
}
Related
I am learning to develop Android applications and have come across a problem with my app. I have created an app that will allow user to type some text and when a button is pressed, a function is called that performs parsing the input string to double and then displays it. I have received no errors, but whenever I run the app on any emulator, it says "Unfortunately, myapp has stopped".
Here is the LogCat:
04-04 14:34:11.579: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:11.969: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:12.089: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:12.720: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:12.860: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:12.979: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:13.069: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:13.479: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:13.599: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:14.009: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:14.129: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:14.320: D/libEGL(657): loaded /system/lib/egl/libGLES_android.so
04-04 14:34:14.390: D/libEGL(657): loaded /system/lib/egl/libEGL_emulation.so
04-04 14:34:14.409: D/(657): HostConnection::get() New Host Connection established 0xd7820, tid 657
04-04 14:34:14.429: D/libEGL(657): loaded /system/lib/egl/libGLESv1_CM_emulation.so
04-04 14:34:14.449: D/libEGL(657): loaded /system/lib/egl/libGLESv2_emulation.so
04-04 14:34:14.519: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:14.579: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:14.719: W/EGL_emulation(657): eglSurfaceAttrib not implemented
04-04 14:34:14.769: D/OpenGLRenderer(657): Enabling debug mode 0
04-04 14:34:15.049: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:15.173: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:15.579: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:15.790: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:16.030: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:16.109: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:16.549: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:16.739: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:17.029: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:17.220: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:27.099: D/AndroidRuntime(657): Shutting down VM
04-04 14:34:27.099: W/dalvikvm(657): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
04-04 14:34:27.219: E/AndroidRuntime(657): FATAL EXCEPTION: main
04-04 14:34:27.219: E/AndroidRuntime(657): java.lang.IllegalStateException: Could not execute method of the activity
04-04 14:34:27.219: E/AndroidRuntime(657): at android.view.View$1.onClick(View.java:3044)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.view.View.performClick(View.java:3511)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.view.View$PerformClick.run(View.java:14105)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.os.Handler.handleCallback(Handler.java:605)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.os.Handler.dispatchMessage(Handler.java:92)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.os.Looper.loop(Looper.java:137)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.reflect.Method.invokeNative(Native Method)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.reflect.Method.invoke(Method.java:511)
04-04 14:34:27.219: E/AndroidRuntime(657): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-04 14:34:27.219: E/AndroidRuntime(657): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-04 14:34:27.219: E/AndroidRuntime(657): at dalvik.system.NativeStart.main(Native Method)
04-04 14:34:27.219: E/AndroidRuntime(657): Caused by: java.lang.reflect.InvocationTargetException
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.reflect.Method.invokeNative(Native Method)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.reflect.Method.invoke(Method.java:511)
04-04 14:34:27.219: E/AndroidRuntime(657): at android.view.View$1.onClick(View.java:3039)
04-04 14:34:27.219: E/AndroidRuntime(657): ... 11 more
04-04 14:34:27.219: E/AndroidRuntime(657): Caused by: java.lang.NumberFormatException: Invalid double: "android.widget.EditText#40f7be40"
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.StringToReal.invalidReal(StringToReal.java:63)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.StringToReal.initialParse(StringToReal.java:114)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.StringToReal.parseDouble(StringToReal.java:263)
04-04 14:34:27.219: E/AndroidRuntime(657): at java.lang.Double.parseDouble(Double.java:295)
04-04 14:34:27.219: E/AndroidRuntime(657): at com.example.coinage.MainActivity.convert(MainActivity.java:25)
04-04 14:34:27.219: E/AndroidRuntime(657): ... 14 more
04-04 14:34:28.069: I/dalvikvm(657): threadid=3: reacting to signal 3
04-04 14:34:28.179: I/dalvikvm(657): Wrote stack traces to '/data/anr/traces.txt'
04-04 14:34:29.729: I/Process(657): Sending signal. PID: 657 SIG: 9
Method that performs Computation
public void convert(View view){
int countOf2Po = 0, countOf1Po = 0, countOf50p = 0, countOf20p = 0, countOf2p = 0, countOf1p = 0;
EditText amt = (EditText) findViewById (R.id.amount);
TextView penny = (TextView) findViewById (R.id.penny);
double amount = Double.parseDouble(amt.toString()) * 100;
while(amount >= 200){
amount = amount - 200;
countOf2Po++;
}
while(amount >= 100){
amount = amount - 100;
countOf1Po++;
}
while(amount >= 50){
amount = amount - 50;
countOf50p++;
}
while(amount >= 20){
amount = amount - 20;
countOf20p++;
}
while(amount >= 2){
amount = amount - 2;
countOf2p++;
}
if(amount % 2 != 0){
countOf1p++;
}
penny.setText("Converting " + penny + " into coins.");
penny.setVisibility(View.VISIBLE);
}
You're trying to cast the toString() value of the EditText to a double, which is not the text entered into the EditText like you expected, but the name the name of the class concatenated with the instance's hash code:
The toString method for class Object returns a string consisting of
the name of the class of which the object is an instance, the at-sign
character `#', and the unsigned hexadecimal representation of the hash
code of the object. In other words, this method returns a string equal
to the value of:
getClass().getName() + '#' + Integer.toHexString(hashCode())
What you want to do, is to retrieve the entered text using getText(), and convert that to a String:
double amount = Double.parseDouble(amt.getText().toString()) * 100;
Note that this may lead to a NumberFormatException if the input is not a proper double.
Here's the output I'm taking about:
10-09 21:57:56.344: W/dalvikvm(3141): threadid=1: thread exiting with uncaught exception (group=0x40cb8378)
10-09 21:57:56.364: E/AndroidRuntime(3141): FATAL EXCEPTION: main
10-09 21:57:56.364: E/AndroidRuntime(3141): java.lang.IllegalStateException: Activity has been destroyed
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1329)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:548)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:532)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.trade.MainActivity.showFragment(MainActivity.java:85)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.trade.MainActivity.showSettingsFragment(MainActivity.java:179)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.trade.Home.setting(Home.java:40)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.trade.Home.onOptionsItemSelected(Home.java:31)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.app.Activity.onMenuItemSelected(Activity.java:2534)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:353)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:964)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.android.internal.view.menu.ListMenuPresenter.onItemClick(ListMenuPresenter.java:166)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.widget.AdapterView.performItemClick(AdapterView.java:298)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.widget.AbsListView.performItemClick(AbsListView.java:1086)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2859)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.widget.AbsListView$1.run(AbsListView.java:3533)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.os.Handler.handleCallback(Handler.java:615)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.os.Handler.dispatchMessage(Handler.java:92)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.os.Looper.loop(Looper.java:213)
10-09 21:57:56.364: E/AndroidRuntime(3141): at android.app.ActivityThread.main(ActivityThread.java:4787)
10-09 21:57:56.364: E/AndroidRuntime(3141): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 21:57:56.364: E/AndroidRuntime(3141): at java.lang.reflect.Method.invoke(Method.java:511)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
10-09 21:57:56.364: E/AndroidRuntime(3141): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
10-09 21:57:56.364: E/AndroidRuntime(3141): at dalvik.system.NativeStart.main(Native Method)
10-09 21:57:58.847: I/Process(3141): Sending signal. PID: 3141 SIG: 9
The exception is unknown to me. Please help me understand it.
Thanks
I will try my best to answer your general question in a general regard to the excpetion, since that is what you asked. If you want specific help for a specific bug in your application you will need to post your MainActivity here (especially the parts around line 85).
The excpetion you are getting is an android system exception that is there to tell you that you are operating on an Activity that is not "alive" anymore. This is surprisingly easy to achieve and has most likely to do with improper variable householding (or improper instance householding as was mentioned in the comments below your question. Do not build Activity instances yourself via the new operator). An example might be as follows
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class MyActivity extends Activity {
public static Activity instance;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (instance != null) {
instance.setContentView(R.layout.myLayout);
}
instance = this;
finish();
startActivity(new Intent(this, MyActivity.class));
}
}
As you might recognize in this simple example, the variable instance is only read upon the first re-entrance into the activity! But there is still a reference to the old (now "dead") activity in there. So what should the system do? Perform an action on this "dead" activity? No, it will give you the above seen exception
So in short: it is very likely that you either have a Fragment, a Dialog or another integral part of the UI "operating on" a "dead" activity (operating on = using a reference to it or some resources (FragmentManager...) from it)
As I said your error is probably very easy to fix, give us your code and we'll be able to help. But maybe you are even able to fix it yourself using the above information - which would surely be more satisfactory to yourself I guess :)
I'm a newbie in Android and working on my first app.
I have the main activity with no ActionBar in it. And I don't want to display any menu in that Activity. Everything is working just fine But when I press the menu button present in the device itself, it causes my app to force close instead of just ignoring it.
I'm developing for sdk >=8 so I'm using the support library. I have tried adding OnCreateOptionMenu() in the code with nothing in it but ended up with same results.
The name of my app is GUI and the package is gui. Here is the Logcat:
10-09 19:52:32.920: E/AndroidRuntime(7440): FATAL EXCEPTION: main
10-09 19:52:32.920: E/AndroidRuntime(7440): java.lang.NullPointerException
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.support.v7.app.ActionBarImplICS.getThemedContext(ActionBarImplICS.java:274)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.support.v7.app.ActionBarActivityDelegate.getMenuInflater(ActionBarActivityDelegate.java:89)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.support.v7.app.ActionBarActivity.getMenuInflater(ActionBarActivity.java:71)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.app.Activity.onCreatePanelMenu(Activity.java:2554)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:224)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.support.v7.app.ActionBarActivity.superOnCreatePanelMenu(ActionBarActivity.java:224)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.support.v7.app.ActionBarActivityDelegateICS.onCreatePanelMenu(ActionBarActivityDelegateICS.java:141)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.support.v7.app.ActionBarActivity.onCreatePanelMenu(ActionBarActivity.java:199)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.onCreatePanelMenu(ActionBarActivityDelegateICS.java:280)
10-09 19:52:32.920: E/AndroidRuntime(7440): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:453)
10-09 19:52:32.920: E/AndroidRuntime(7440): at com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel(PhoneWindow.java:853)
10-09 19:52:32.920: E/AndroidRuntime(7440): at com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java:1535)
10-09 19:52:32.920: E/AndroidRuntime(7440): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2052)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3924)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:3872)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3007)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.os.Handler.dispatchMessage(Handler.java:99)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.os.Looper.loop(Looper.java:137)
10-09 19:52:32.920: E/AndroidRuntime(7440): at android.app.ActivityThread.main(ActivityThread.java:4921)
10-09 19:52:32.920: E/AndroidRuntime(7440): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 19:52:32.920: E/AndroidRuntime(7440): at java.lang.reflect.Method.invoke(Method.java:511)
10-09 19:52:32.920: E/AndroidRuntime(7440): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
10-09 19:52:32.920: E/AndroidRuntime(7440): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
10-09 19:52:32.920: E/AndroidRuntime(7440): at dalvik.system.NativeStart.main(Native Method)
I can't figure out what's the cause of this error. Please help me to locate it. If any other info is needed then plz let me know.
My guess is that this is a bug in the AppCompat library. If you take a look at the code for ActionBarImplICS.getThemedContext() you see that it's the mActionBar that is null:
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.3_r1/android/support/v7/app/ActionBarImplICS.java#ActionBarImplICS.getThemedContext%28%29
My guess is that you're using an activity without a title (and thus also without an actionbar):
requestWindowFeature(Window.FEATURE_NO_TITLE);
If I remove this and launch the activity with a title/actionbar I haven't been able to reproduce the crash. Now, running the app with a titlebar when you don't want or need one isn't a very good option. My suggestion is that you override the Menu key press. The app stopped crashing for me when I did this:
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ( keyCode == KeyEvent.KEYCODE_MENU ) {
// do nothing
return true;
}
return super.onKeyDown(keyCode, event);
}
Looks like this will be fixed in the next support library release http://code.google.com/p/android/issues/detail?id=61394
I have a phone Galaxy S (GT-I9003) that is unable to play a video with resolution (320x480) while all the other models of Galaxy S are able to display that video.
Here are the logs
10-09 06:44:54.232: W/MediaPlayer(1907): info/warning (1, 26)
10-09 06:44:54.232: E/PlayerDriver(1278): Command PLAYER_INIT completed with an error or info PVMFFailure
10-09 06:44:54.232: E/MediaPlayer(1907): error (1, -1)
10-09 06:44:54.232: W/System.err(1907): java.io.IOException: Prepare failed.: status=0x1
10-09 06:44:54.240: W/System.err(1907): at android.media.MediaPlayer.prepare(Native Method)
10-09 06:44:54.240: W/System.err(1907): at com.MovieController.startMovie(MovieController.java:180)
10-09 06:44:54.240: W/System.err(1907): at com.MovieController.show(MovieController.java:88)
10-09 06:44:54.240: W/System.err(1907): at com.MovieController.play(MovieController.java:120)
10-09 06:44:54.240: W/System.err(1907): at com.android.sphybrid.D2CommandController.execute(D2CommandController.java:73)
10-09 06:44:54.240: W/System.err(1907): at com.android.sphybrid.WGFWebViewClient.doWithTitle(WGFWebViewClient.java:114)
10-09 06:44:54.240: W/System.err(1907): at com.android.sphybrid.WGFWebViewClient.onPageFinished(WGFWebViewClient.java:93)
10-09 06:44:54.240: W/System.err(1907): at jp.android.survivors.WebViewClient.onPageFinished(WebViewClient.java:96)
10-09 06:44:54.240: W/System.err(1907): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:281)
10-09 06:44:54.240: W/System.err(1907): at android.os.Handler.dispatchMessage(Handler.java:99)
10-09 06:44:54.240: W/System.err(1907): at android.os.Looper.loop(Looper.java:123)
10-09 06:44:54.240: W/System.err(1907): at android.app.ActivityThread.main(ActivityThread.java:4632)
10-09 06:44:54.240: W/System.err(1907): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 06:44:54.240: W/System.err(1907): at java.lang.reflect.Method.invoke(Method.java:521)
10-09 06:44:54.240: W/System.err(1907): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-09 06:44:54.240: W/System.err(1907): at dalvik.system.NativeStart.main(Native Method)
10-09 06:44:54.240: I/MovieFile(1907): Movie File: <null>
10-09 06:44:54.248: W/PlayerDriver(1278): PVMFInfoErrorHandlingComplete
10-09 06:44:54.279: I/AudioFlinger(1278): getNextBuffer() no more data for track 4096 on thread 0x34cc8
10-09 06:44:55.709: D/wpa_supplicant(1474): wpa_driver_tista_driver_cmd LINKSPEED
10-09 06:44:55.709: D/wpa_supplicant(1474): Link Speed command
10-09 06:44:55.709: D/wpa_supplicant(1474): buf LinkSpeed 54
10-09 06:44:56.287: I/AudioStreamOutALSA(1278): (virtual android::status_t android::AudioStreamOutALSA::standby()) enter
10-09 06:44:56.373: D/AudioStreamOutALSA(1278): Output standby called!!. Turn off PCM device.
10-09 06:44:56.373: I/ALSAStreamOps(1278): [ALSAStreamOps]codecOff mode = 0
10-09 06:44:56.373: D/ALSAControl(1278): ALSAControl::set index = 0
10-09 06:44:56.373: I/ALSAControl(1278): <set>id = 1079651552, info = 1079651272, name = Amp Enable
10-09 06:44:56.373: I/ALSAControl(1278): <set>mHandle Success 215600
10-09 06:44:56.420: D/BT HS/HF(1489): gsmAsuToSignal=27
10-09 06:44:56.420: D/ALSAControl(1278): ALSAControl::set index = 0
10-09 06:44:56.420: I/ALSAControl(1278): <set>id = 1079651552, info = 1079651272, name = Idle Mode
10-09 06:44:56.420: I/ALSAControl(1278): <set>mHandle Success 215600
10-09 06:44:56.490: I/AudioStreamOutALSA(1278): [AudioOutLock]Relase_wake_Lock
I just found out that the movie i was trying to play in Android 2.2.1 was in some other codec (JVT/AC) and resolution was (320 x 480). I changed the codec to MPEG-4 without changing the resolution, it started working. I suppose it is an unsupported format.
In one of my activities you can click on an image button and a dialog opens up to ask you to open up the Gallery. Once opened up you can click on one of those images in your gallery.
What I want that the clicked image is set as the image of the image button. This image should stay there even when the user kills the app (when he opens up the app again the chosen image should still be there).
I chose to do all this work with the shared preferences but can't get it working. I get an error when I click on an image in the gallery. Any suggestions??
UPDATE: The error I receive is:
Unfortunately, the process com.myname.android has stopped
Here is my code, beginning with the onActivityResult:
private String selectedImagePath;
private String mFileName;
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == PICK_FROM_FILE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
Log.v("IMAGE PATH====>>>> ",selectedImagePath);
}
storePath();
retrievePath();
convertPathToImage();
}
}
private void storePath() {
final SharedPreferences sPreference = getSharedPreferences(
"pref_key", MODE_PRIVATE);
final Editor spEditor = sPreference.edit();
spEditor.putString("img_path", mFileName);
spEditor.commit();
}
private void retrievePath() {
final SharedPreferences sharedPreference = getSharedPreferences(
"pref_key", MODE_PRIVATE);
if (sharedPreference.contains("img_path")) {
mFileName = sharedPreference.getString("img_path",
null);
}
}
private void convertPathToImage() {
File imgFile = new File(mFileName);
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ImageButton myImage = (ImageButton) findViewById(R.id.image);
myImage.setImageBitmap(myBitmap);
}
}
And here is the LogCat:
05-30 15:27:14.567: D/dalvikvm(634): GC_CONCURRENT freed 1K, 3% free 11478K/11783K, paused 5ms+4ms
05-30 15:27:14.597: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:14.617: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:14.926: D/gralloc_goldfish(634): Emulator without GPU emulation detected.
05-30 15:27:26.767: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:26.877: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:30.616: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:30.626: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:32.086: W/IInputConnectionWrapper(634): showStatusIcon on inactive InputConnection
05-30 15:27:33.366: E/ActivityThread(634): Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-30 15:27:33.366: E/ActivityThread(634): android.app.IntentReceiverLeaked: Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-30 15:27:33.366: E/ActivityThread(634): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:763)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:567)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1043)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1030)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1024)
05-30 15:27:33.366: E/ActivityThread(634): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:341)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:65)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.app.ResolverActivity.onCreate(ResolverActivity.java:99)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:53)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.Activity.performCreate(Activity.java:4465)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-30 15:27:33.366: E/ActivityThread(634): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 15:27:33.366: E/ActivityThread(634): at android.os.Looper.loop(Looper.java:137)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-30 15:27:33.366: E/ActivityThread(634): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 15:27:33.366: E/ActivityThread(634): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 15:27:33.366: E/ActivityThread(634): at dalvik.system.NativeStart.main(Native Method)
05-30 15:27:35.987: V/IMAGE PATH====>>>>(634): /mnt/sdcard/Mercedes_SLS_AMG.jpg
05-30 15:27:36.176: D/AndroidRuntime(634): Shutting down VM
05-30 15:27:36.176: W/dalvikvm(634): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
05-30 15:27:36.206: E/AndroidRuntime(634): FATAL EXCEPTION: main
05-30 15:27:36.206: E/AndroidRuntime(634): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://media/external/images/media/20 }} to activity {com.xyz.android.taskreminder/com.xyz.android.taskreminder.ReminderEditActivity}: java.lang.NullPointerException
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.deliverResults(ActivityThread.java:2980)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3023)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.access$1100(ActivityThread.java:123)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1177)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.os.Looper.loop(Looper.java:137)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 15:27:36.206: E/AndroidRuntime(634): at dalvik.system.NativeStart.main(Native Method)
05-30 15:27:36.206: E/AndroidRuntime(634): Caused by: java.lang.NullPointerException
05-30 15:27:36.206: E/AndroidRuntime(634): at java.io.File.fixSlashes(File.java:185)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.io.File.<init>(File.java:134)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.xyz.android.taskreminder.ReminderEditActivity.convertPathToImage(ReminderEditActivity.java:249)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.xyz.android.taskreminder.ReminderEditActivity.onActivityResult(ReminderEditActivity.java:227)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.Activity.dispatchActivityResult(Activity.java:4649)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.deliverResults(ActivityThread.java:2976)
05-30 15:27:36.206: E/AndroidRuntime(634): ... 11 more
05-30 15:27:36.376: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:36.396: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:36.787: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:36.847: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:37.386: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:37.406: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:37.887: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:37.947: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:38.396: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:38.416: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:38.897: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:38.927: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:39.406: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:39.426: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:39.917: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:39.927: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:40.426: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:40.446: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:40.917: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:40.947: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:41.426: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:41.447: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:41.937: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:41.977: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:42.446: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:42.467: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:42.937: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:42.956: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:43.446: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:43.467: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:43.947: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:43.976: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:44.456: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:44.477: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:44.966: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:44.986: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:45.466: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:45.487: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
This is probably a bug in Android. See http://code.google.com/p/android/issues/detail?id=29399. It shouldn't effect the app though which should still be able to get a result back from the gallery.
05-30 15:27:36.206: E/AndroidRuntime(634): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://media/external/images/media/20 }} to activity {com.ndroidstudios.android.taskreminder/com.ndroidstudios.android.taskreminder.ReminderEditActivity}: java.lang.NullPointerException
...
05-30 15:27:36.206: E/AndroidRuntime(634): Caused by: java.lang.NullPointerException
This is the problem. mFileName is null when you try to use it to create a new File. In retrievePath, when you try to pull "img_path" out of your preferences the default value is null, so I'm guessing it's getting set to null there. Check in the debugger to make sure mFileName is getting set to a valid String from your preferences.