android - Getting information of Button on click -
i have map<string, string>
stores id
, name
. creating buttons map, button text set name. how can information of button on click
event? say, want id when button clicked.
please note id unique, name can duplicated.
i have tried setting sethint(id)
button while creation. but, don't find gethint()
method on view
under onclick().
you store id in tag property of button , retrieve gettag()
e.g.
button b=new button(); b.settag(yourid); b.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { log.i("tag", "my tag " + v.gettag()); } });
Comments
Post a Comment