android - How to set OnTouchListener for a list of Views? -


please, need help. want set ontouchlistener each view have in table of view. here code:

for(textview tv : getchoices()){     choiceslayout.addview(tv); } 

the getchoices methode return array of textviews. want set ontouchlistener each textview , add layout. can me please!

i tried this:

for(textview tv : getchoices()){ tv.setontouchlistener(new ontouchlistener() {         @override         public boolean ontouch(view v, motionevent event) {             if(event.getaction()==motionevent.action_down){                 clipdata data = clipdata.newplaintext("", "");                 dragshadowbuilder shadowbuilder = new view.dragshadowbuilder(v);                 // start dragging item                 v.startdrag(data, shadowbuilder, v, 0);                 return true;             }else{                 return false;             }          }     });     choiceslayout.addview(tv); } 

but doesn't work.

i don't have idea how implementing list of texte views, guess in listview.

you can try adding ontouch in imageadapter.

this little tutorial . hope helped


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -