android - How to change image on listview -
i have problem when click change image listview: need change image in row click. , when choose image, image chosen become image normal. please me!
mainactivity
public void songpicked(final view view) throws ioexception { musicsrv.setsong(integer.parseint(view.gettag().tostring())); imageview imageview = (imageview) view.findviewbyid(r.id.imageview); imageview.setimageresource(r.drawable.playc); musicsrv.playsong(); if (playbackpaused) { setcontroller(); playbackpaused = false; } controller.show(0); }
myadapter
public view getview(final int position, view convertview, viewgroup parent) { //map song layout relativelayout songlay = (relativelayout) songinf.inflate (r.layout.song, parent, false); //get title , artist views textview songview = (textview) songlay.findviewbyid(r.id.song_title); textview artistview = (textview) songlay.findviewbyid(r.id.song_artist); final imageview imageview= (imageview) songlay.findviewbyid(r.id.imageview); //get song using position song currsong = songs.get(position); //get title , artist strings songview.settext(currsong.gettitle()); artistview.settext(currsong.getartist()); imageview.setimagedrawable( getcontext().getdrawable(r.drawable.play)); //set position tag songlay.settag(position); return songlay; }
Comments
Post a Comment