java - Listview with multiple clocks -
java - Listview with multiple clocks -
i'm trying create listview hold multiple clocks time in each row jumping around.
in getview have
date date=new date(); chagre.settag(position); handler mclockhandler = new handler(); mupdateclocktask clocktask = new mupdateclocktask(chagre, chagre.gettag().tostring(), date); mclockhandler.post(clocktask); and runnable
public class mupdateclocktask implements runnable { private textview tv; handler mclockhandler = new handler(); string tag; date date; public mupdateclocktask(textview tv, string tag, date date) { this.tv = tv; this.tag = tag; this.date = date; } public void run() { if (tv.gettag().tostring().equals(tag)) { simpledateformat time_format = new simpledateformat("h:mm:ss a"); string time = time_format.format(date); tv.settext(time.trim()); mclockhandler.postdelayed(this, 1000); notes.notifydatasetchanged(); } } };
android doesn't create rows in list @ same time - creates them scroll them , destroys them afterwards, or recycle row appeared elsewhere in list. runnables have reference textview beingness used random rows in list , destroyed unexpectedly.
java android listview timer runnable
Comments
Post a Comment