android - Strange ClassCastException with a Spinner -
i have code:
spinner entrega=(spinner)findviewbyid(r.id.comboentrega); //this line cracks arrayadapter<charsequence> adapter = arrayadapter.createfromresource(this, r.array.arrayentrega, android.r.layout.simple_spinner_item); // specify layout use when list of choices appears adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); // apply adapter spinner entrega.setadapter(adapter);
in layout:
<spinner android:id="@+id/comboentrega" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/textview4" />
when run app, receive stacktrace:
03-13 11:43:13.748: e/androidruntime(1668): fatal exception: main 03-13 11:43:13.748: e/androidruntime(1668): java.lang.runtimeexception: unable start activity componentinfo{com.publidirecta.appazafata/com.publidirecta.appazafata.incidencias}: java.lang.classcastexception: android.widget.button 03-13 11:43:13.748: e/androidruntime(1668): @ android.app.activitythread.performlaunchactivity(activitythread.java:1659) 03-13 11:43:13.748: e/androidruntime(1668): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1675) 03-13 11:43:13.748: e/androidruntime(1668): @ android.app.activitythread.access$1500(activitythread.java:121) 03-13 11:43:13.748: e/androidruntime(1668): @ android.app.activitythread$h.handlemessage(activitythread.java:943) 03-13 11:43:13.748: e/androidruntime(1668): @ android.os.handler.dispatchmessage(handler.java:99) 03-13 11:43:13.748: e/androidruntime(1668): @ android.os.looper.loop(looper.java:130) 03-13 11:43:13.748: e/androidruntime(1668): @ android.app.activitythread.main(activitythread.java:3701) 03-13 11:43:13.748: e/androidruntime(1668): @ java.lang.reflect.method.invokenative(native method) 03-13 11:43:13.748: e/androidruntime(1668): @ java.lang.reflect.method.invoke(method.java:507) 03-13 11:43:13.748: e/androidruntime(1668): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:866) 03-13 11:43:13.748: e/androidruntime(1668): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:624) 03-13 11:43:13.748: e/androidruntime(1668): @ dalvik.system.nativestart.main(native method) 03-13 11:43:13.748: e/androidruntime(1668): caused by: java.lang.classcastexception: android.widget.button 03-13 11:43:13.748: e/androidruntime(1668): @ com.publidirecta.appazafata.incidencias.oncreate(incidencias.java:122) 03-13 11:43:13.748: e/androidruntime(1668): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 03-13 11:43:13.748: e/androidruntime(1668): @ android.app.activitythread.performlaunchactivity(activitythread.java:1623)
why getting classcastexception android.widget.button, if not casting button? in case may help, spinner first attached right side of screen, , working fine. noticed , attached left side, must be, , exception started.
anybody has idea this? thank you.
Comments
Post a Comment