我在我的
onCreate()
方法中添加了这部分代码,导致我的应用程序崩溃。需要帮助。
日志:
android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread
that created a view hierarchy can touch its views.
代码:
final TextView timerDisplayPanel = (TextView) findViewById(R.id.textView2);
Timer t = new Timer();
t.schedule(new TimerTask(){
public void run(){
timerInt++;
Log.d("timer", "timer");
timerDisplayPanel.setText("Time ="+ timerInt +"Sec");
}
},10, 1000);