나는이 같은 TableRow 팽창 :안드로이드 타이머 그리고 UI 스레드
final TableRow tr1 = (TableRow)LayoutInflater.from(this).inflate(R.layout.attrib_row_survey, null);
tr1.setOnTouchListener(this);
tl1.addView(tr1);
이 내 카운터를 수행하는 방법이다 :이 타이머를 실행하고 그것을 보여줄 때
new CountDownTimer(30000, 1000) {
public void onTick(long millisUntilFinished) {
((TextView)tr1.findViewById(R.id.textView2)).setText("Seconds Remaining: " + millisUntilFinished/1000);
}
public void onFinish() {
((TextView)tr1.findViewById(R.id.textView2)).setText("DONE");
}
}.start();
문제이며, 행, UI가 매우 느리며 타이머가 뒤쳐집니다. onTouchListener()에서 view.setBackGroundColor (Color.BLACK)를 클릭하고 클릭하면 지연됩니다.
하나의 개선점은'findViewById()'를 반복적으로 호출하는 대신'textView2'에 대한 참조를 저장하는 것입니다. 그러나 CountDownTimer는 눈에 띄는 지연을 일으키지 않을 것입니다. 그 밖의 무엇을하고 있습니까? – Sam
내 대답 [여기] (http://stackoverflow.com/questions/3733867/stop-watch-logic) – st0le
에 대한 관심을 가질 수 있습니다 ... –