I m detecting which button i clicked:
public void next_page(View view){
//if else - works:
if( view.getId() == "fly_button")
Log.d(LOG, " fly button clicked");
else if (view.getId() == "imageButton")
Log.d(LOG, "image button clicked");
//switch does not work:
// every id is a string, how to show it as integer in "case"?
switch( view.getId() ){
case "fly_button":
Log.d(LOG, "fly button clicked");
case "imageButton":
Log.d(LOG, "image button clicked");
}
Aucun commentaire:
Enregistrer un commentaire