play pause toggle in android listview -
i have listview play image button in every row ...
play , pause function
@override public void playpauseonclick(int position) { product product = songlist.get(position); if (product.paused) { product.setplaypauseid(r.drawable.ic_pause); product.paused=false; }else { product.setplaypauseid(r.drawable.ic_play); product.paused = true; } adapter.notifydatasetchanged(); }
this works fine , have no problem...
but need achieve set clicked position play icon before setting new position pause.
can me this, please !!?
i've modified hitesh gehlot's answer:
@override public void playpauseonclick(int position) { product product = movielist.get(position); if (product.paused) { for(int i=0;i< movielist.size();i++) { movielist.get(i).setplaypauseid(r.drawable.ic_play); movielist.get(i).paused = true; } product.setplaypauseid(r.drawable.ic_pause); product.paused=false; }else { product.setplaypauseid(r.drawable.ic_play); product.paused = true; } adapter.notifydatasetchanged(); }
Comments
Post a Comment