I want to display letters using textview. and the letter should display in textview after some time interval.
i used following code….
String a="Apple";
String b="";
.......
.......
public void run() {
for (int i = 0; i < 5; i++) {
b=b+""+a.charAt(i);
mTextView.setText(b); //Problem here
Log.d("Letters",""+b);
try {
sleep(2000);
} catch (InterruptedException e) {}
}
Log cat Result:
android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
Any Solution?
You can not change UI controls from other threads. Update your code in a next way: