我在我的方法中添加了这部分代码,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);