java - how to get textview text -
in android app, have activity contain listview. , within each row of listview, have listview let called lv. inside lv, contain textview. question how can text listview (a)?
i know if there 1 listview , in order text of each row when click on button, can use following code
textview.gettext().tostring();
however, when try code text in lv, give me last value (n row) in lv. not able text of 1st row n-1 row of lv.
update: follow code want text, ordered[] passed custom adapter custom adapter (which following code)
public view getview(int position,view view,viewgroup parent) { layoutinflater inflater=((activity) context).getlayoutinflater(); view rowview=inflater.inflate(layoutresourceid, null,true); txt1 = (textview)rowview.findviewbyid(r.id.textview1); txt2 = (textview)rowview.findviewbyid(r.id.textview2); txt3 = (textview)rowview.findviewbyid(r.id.textview3); txt4 = (textview)rowview.findviewbyid(r.id.textview4); txt5 = (textview)rowview.findviewbyid(r.id.textview5); txt6 = (textview)rowview.findviewbyid(r.id.textview6); txtoid = (textview)rowview.findviewbyid(r.id.textview7); final button btnget = (button)rowview.findviewbyid(r.id.btnget); tmp = position; string tmp2 = string.valueof(ordered[position]); txtoid.settext(tmp2); btnget.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub if(btnconfirm.gettext().tostring().equals("get")){ string tmp1 = txtq.gettext().tostring(); system.out.println("tmp1: "+tmp1); } } }); ....
anyone nice!
thanks
rowview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view rootview) { // todo auto-generated method stub textview mytext = (textview)rootview.findviewbyid(r.id.textview7); log.d("","mytext:" + mytext.gettext()); //you can each row values. } });
Comments
Post a Comment