-2

I keep receiving an error when I launch my android app. It was working fine prior to adding two classes which designed and built a databases. The logcat messages are as follows!

12-04 05:39:54.370: D/ActivityThread(25676): setTargetHeapUtilization:0.25
12-04 05:39:54.370: D/ActivityThread(25676): setTargetHeapIdealFree:8388608
12-04 05:39:54.370: D/ActivityThread(25676): setTargetHeapConcurrentStart:2097152
12-04 05:39:54.500: D/AbsListView(25676): Get MotionRecognitionManager
12-04 05:39:54.620: I/Adreno200-EGLSUB(25676): <ConfigWindowMatch:2136>: Format RGBA_8888.
12-04 05:39:54.640: E/(25676): <s3dReadConfigFile:75>: Can't open file for reading
12-04 05:39:54.640: E/(25676): <s3dReadConfigFile:75>: Can't open file for reading
12-04 05:40:05.331: W/dalvikvm(25676): threadid=1: thread exiting with uncaught exception (group=0x4146d438)
12-04 05:40:05.331: E/AndroidRuntime(25676): FATAL EXCEPTION: main
12-04 05:40:05.331: E/AndroidRuntime(25676): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mamon.pumpitup/com.mamon.pumpitup.AddActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.EditText
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.app.ActivityThread.access$700(ActivityThread.java:143)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.os.Handler.dispatchMessage(Handler.java:99)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.os.Looper.loop(Looper.java:137)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.app.ActivityThread.main(ActivityThread.java:4967)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at java.lang.reflect.Method.invokeNative(Native Method)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at java.lang.reflect.Method.invoke(Method.java:511)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1011)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at dalvik.system.NativeStart.main(Native Method)
12-04 05:40:05.331: E/AndroidRuntime(25676): Caused by: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.EditText
12-04 05:40:05.331: E/AndroidRuntime(25676):    at com.mamon.pumpitup.AddActivity.onCreate(AddActivity.java:27)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.app.Activity.performCreate(Activity.java:5160)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
12-04 05:40:05.331: E/AndroidRuntime(25676):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
12-04 05:40:05.331: E/AndroidRuntime(25676):    ... 11 more
Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67
Mmmmmm
  • 11

2 Answers2

0
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mamon.pumpitup/com.mamon.pumpitup.AddActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.EditText

its is very clear in this line

you are trying to cast Button view to EditText view in com.mamon.pumpitup.AddActivity Class you might have referenced wrong R.id.your_view

0

you are trying something like this:

Button b = (EditText)findViewById(R.id.source);

and you shoud write one of these, depend what you want:

Button b = (Button)findViewById(R.id.source);
EditText ed= (EditText)findViewById(R.id.source);
Andres Cárdenas
  • 720
  • 1
  • 5
  • 26