I am new to android and just starting through some tutorial videos. My requirement is initially i need to show the textview text to \"red\" and after 5-10 sec, need to chang
Try to Use Handler,
Handler h=new Handler();
h.postDelayed(new Runnable(){
public void run(){
//change your text here
}
}, time_delay);
_tv = (TextView) findViewById( R.id.textView1 );
tv2 = (TextView) findViewById( R.id.textView2 );
_tv.setText( "red" );
_t = new Timer();
_t.scheduleAtFixedRate( new TimerTask() {
@Override
public void run() {
_count++;
runOnUiThread(new Runnable() //run on ui thread
{
public void run()
{
tv2.setText(""+_count);
if(_count==5)
{
_tv.setText("hello red" );
_tv.setTextColor(Color.RED);
}
}
});
}
}, 1000, 1000 );