android - How to Identify Particular(specific) view is clicked for Dynamically Created Views -


i new android programming.
have created buttons,edittext dynamically , set onclick listener of them. here buttons , edittext have write different logic.

if write

 public void onclick(view v) {   if(v instanceof button){      // thing   }else if(v instanceof edittext){  // thing }   } 

for buttons , edittext same logic applied.
want specific logic buttons , edittext. can setting tag editext/buttons , identify.
solution ?

    in onclick can write switch case based on id of each component (button etc):          @override         public void onclick(view v) {             switch(v.getid()){                  case r.id.camera:                       break;                  case r.id.camera_focused:                       break; } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -