0
My app is giving an error that I just have no idea how to fix, then I copied the error that gives (on mobile looks like this: "The app'app name' stopped") can help me identify the problem?
10-14 00:33:41.677: E/androidruntime(12260): FATAL EXCEPTION: main 10-14 00:33:41.677: E/androidruntime(12260): Process: with.example.messaging for her, PID: 12260 10-14 00:33:41.677: E/Androidruntime(12260): java.lang.Runtimeexception: Unable to start Activity Componentinfo{com.example.messaging for her/com.example.messaging for her . Primeiratela}: java.lang.Classcastexception: android.widget.Button cannot be cast to android.widget.Imageview 10-14 00:33:41.677: E/Androidruntime(12260): at android.app.Activitythread.performLaunchActivity(Activitythread.java:2358)
10-14 00:33:41.677: E/Androidruntime(12260): at android.app.Activitythread.handleLaunchActivity(Activitythread.java:2420)
10-14 00:33:41.677: E/Androidruntime(12260): at android.app.Activitythread.access$900(Activitythread.java:154) 10-14
00:33:41.677: E/Androidruntime(12260): at android.app.Activitythread$H.handleMessage(Activitythread.java:1321)
10-14 00:33:41.677: E/Androidruntime(12260): at android.os.Handler.dispatchMessage(Handler.java:102) 10-14
00:33:41.677: E/Androidruntime(12260): at android.os.Looper.loop(Looper.java:135) 10-14
00:33:41.677: E/Androidruntime(12260): at android.app.Activitythread.main(Activitythread.java:5294) 10-14
00:33:41.677: E/Androidruntime(12260): at java.lang.reflect.Method.invoke(Native Method) 10-14 00:33:41.677: E/Androidruntime(12260): at java.lang.reflect.Method.invoke(Method.java:372) 10-14 00:33:41.677: E/Androidruntime(12260): at com.android.Internal.os.Zygoteinit$Methodandargscaller.run(Zygoteinit.java:904) 10-14 00:33:41.677: E/Androidruntime(12260): at com.android.Internal.os.Zygoteinit.main(Zygoteinit.java:699) 10-14 00:33:41.677: E/Androidruntime(12260): Caused by: java.lang.Classcastexception: android.widget.Button cannot be cast to android.widget.Imageview 10-14 00:33:41.677: E/Androidruntime(12260): at with.example.messaging for her.PrimeiraTela.onCreate(Primeiratela.java:32) 10-14 00:33:41.677: E/Androidruntime(12260): at android.app.Activity.performCreate(Activity.java:5990) 10-14 00:33:41.677: E/Androidruntime(12260): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 10-14 00:33:41.677: E/Androidruntime(12260): at android.app.Activitythread.performLaunchActivity(Activitythread.java:2311) 10-14 00:33:41.677: E/Androidruntime(12260): ... 10 more
Obs: I don’t know if it does, but I’m using eclipse adt Bundle, but to test the apps using my mobile phone that already has Lollipop... (I can’t use Android Studio, my PC can’t handle.)
Thanks in advance
Bug says you are trying to turn(cast) a Button in Imageview. See the
findViewById()
of Activity Primeiratela– ramaral
Good afternoon Alan, post the code to see where exactly the problem occurred.
– Guilherme Nascimento