I’m developing an android application and after I hit run, I unlock the AVD and click the menu to load my application and I immediately get a “The application closed unexpectedly” message.
The following is the output of my logcat:
02-21 11:36:55.952: D/AndroidRuntime(329): Shutting down VM
02-21 11:36:55.952: W/dalvikvm(329): threadid=1: thread exiting with uncaughtexception (group=0x40015560)
02-21 11:36:55.971: E/AndroidRuntime(329): FATAL EXCEPTION: main
02-21 11:36:55.971: E/AndroidRuntime(329): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.throughputconverter/com.throughputconverter.ThroughputConverterActivity}: java.lang.ClassCastException: android.widget.EditText
02-21 11:36:55.971: E/AndroidRuntime(329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
02-21 11:36:55.971: E/AndroidRuntime(329): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
02-21 11:36:55.971: E/AndroidRuntime(329): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-21 11:36:55.971: E/AndroidRuntime(329): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
02-21 11:36:55.971: E/AndroidRuntime(329): at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 11:36:55.971: E/AndroidRuntime(329): at android.os.Looper.loop(Looper.java:123)
02-21 11:36:55.971: E/AndroidRuntime(329): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-21 11:36:55.971: E/AndroidRuntime(329): at java.lang.reflect.Method.invokeNative(Native Method)
02-21 11:36:55.971: E/AndroidRuntime(329): at java.lang.reflect.Method.invoke(Method.java:507)
02-21 11:36:55.971: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-21 11:36:55.971: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-21 11:36:55.971: E/AndroidRuntime(329): at dalvik.system.NativeStart.main(Native Method)
02-21 11:36:55.971: E/AndroidRuntime(329): Caused by: java.lang.ClassCastException: android.widget.EditText
02-21 11:36:55.971: E/AndroidRuntime(329): at com.throughputconverter.ThroughputConverterActivity.onCreate(ThroughputConverterActivity.java:44)
02-21 11:36:55.971: E/AndroidRuntime(329): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-21 11:36:55.971: E/AndroidRuntime(329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
02-21 11:36:55.971: E/AndroidRuntime(329): ... 11 more
Looks like you’re casting the EditText widget incorrectly or that the widget doesn’t exist in your layout and/or Activity.