My android java button shows up and animates but for some reason my code is never executed -


i have button in android application.

 <button     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="start scanning"     android:id="@+id/bstartscan"     android:enabled="true"     android:clickable="true"     android:layout_below="@+id/third_person_button"     android:layout_toendof="@+id/stitchpcbutton"     android:longclickable="false" /> 

the button animate , show in application, none of teh code below executed.

public void onclick(view v) {     switch (v.getid()) {         case r.id.bstartscan:             findviewbyid(r.id.bstartscan).setenabled(false);             ...             ...             break;         default:             log.w(tag, "unrecognized button click.");     } } 

my other buttons works fine , not understand why button refuses fire.

any ideas? questions?

thank in advance.

<button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="start scanning" android:id="@+id/bstartscan" android:layout_below="@+id/third_person_button" android:layout_toendof="@+id/stitchpcbutton" /> 

use , in activity/fragment oncreate() in

      button startbtn = (button) findviewbyid(r.id.bstartscan); startbtn.setonclicklistner(this); 

remove findviewbyid(r.id.bstartscan) switch() statement...


Comments