0
여러 개의 시계를 보유 할 수 있지만 각 행의 시간이 항상 점프하는 listview를 만들려고합니다. 그것은 그들을 만들어 당신이 그들로 스크롤하고 - 내의 getView에서여러 시계가있는 목록보기
나는
Date date=new Date();
chagre.setTag(position);
Handler mClockHandler = new Handler();
mUpdateClockTask clockTask = new mUpdateClockTask(chagre,
chagre.getTag().toString(), date);
mClockHandler.post(clockTask);
그리고 실행 가능한
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();
}
}
};
그래서 이런 일이 발생하지 않도록 최선의 방법은 무엇입니까? – Paul