java - Error when trying to run app [Android] -


okay im trying make app has 4 images on front page. when click each image want window pop in case doesn't work @ app craches in how :/

05-14 19:10:08.981    2276-2276/com.example.flygplanappen.peterjapp e/androidruntime﹕ fatal exception: main     process: com.example.flygplanappen.peterjapp, pid: 2276     android.content.activitynotfoundexception: no activity found handle intent { act=com.example.flygplanappen.peterjapp.flygos2 }             @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1765)             @ android.app.instrumentation.execstartactivity(instrumentation.java:1485)             @ android.app.activity.startactivityforresult(activity.java:3736)             @ android.app.activity.startactivityforresult(activity.java:3697)             @ android.app.activity.startactivity(activity.java:4007)             @ android.app.activity.startactivity(activity.java:3975)             @ com.example.flygplanappen.peterjapp.flygos$1.onclick(flygos.java:24)             @ android.view.view.performclick(view.java:4756)             @ android.view.view$performclick.run(view.java:19749)             @ android.os.handler.handlecallback(handler.java:739)             @ android.os.handler.dispatchmessage(handler.java:95)             @ android.os.looper.loop(looper.java:135)             @ android.app.activitythread.main(activitythread.java:5221)             @ java.lang.reflect.method.invoke(native method)             @ java.lang.reflect.method.invoke(method.java:372)             @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:899)             @ com.android.internal.os.zygoteinit.main(zygoteinit.java:694) 

you're doing this:

button button = (button) findviewbyid(r.id.imageview4) 

if in xml layout, you'll find imageview4 defined imageview, cannot cast button. imageview subclass of view, , button subclass of view (textview, actually), imageview not subclass of button, , therefore can't cast button that.

however, onclick method work on view, not button.

so, is:

view button = findviewbyid(r.id.imageview4); 

or, if need access methods imageview:

imageview imageview = (imageview) findviewbyid(r.id.imageview4); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -