I am new to Android. I need to view one text on the screen. After thread sleep time I need to add another text on the screen. I have to show the text adding but my code display after all the append operation. How to show adding text one by one?
public class dynamictextview extends Activity {
/** Called when the activity is first created. */
private TextView tv ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = new TextView(this);
tv.setText("Dynamic Text View Test\n");
setContentView(tv);
for(int i=0;i<10;i++)
{
tv.setDrawingCacheBackgroundColor(MODE_APPEND);
tv.append("\nAttempt "+i);
try {
Thread.sleep(500);
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
}