android - How to add onclicklistener to dynamically generated text views -
i have dynamically created textviews in application. want give on click event textviews.. when click on textview, need id of textview..
you try following code.
textview text = new textview(this); text.settext("text here"); ll.addview(text); text.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub toast.maketext(getapplicationcontext(), "id : "+arg0.getid(), toast.length_short).show(); } });
in "ll" layout add textview , after adding put clicklistener() click event.
hope useful you.
Comments
Post a Comment