11
私のonCreate()
メソッドにコードのこの部分を追加し、アプリがクラッシュします。 ヘルプが必要です。アプリが「間違ったスレッド例外から呼び出されました」とクラッシュする
LOGCAT:
android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread
that created a view hierarchy can touch its views.
CODE:
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);
(私は考えていません、ハンドラを使用する方法はあります) - 私はハンドラオブジェクトを使用する必要があると読んでいます。 –