In my activity I call a setText
:
tvdato.setText(String.valueOf("BIEN"));
I would like to know a method to make it provisional, that is, to last for a few seconds drawn on the screen.
In my activity I call a setText
:
tvdato.setText(String.valueOf("BIEN"));
I would like to know a method to make it provisional, that is, to last for a few seconds drawn on the screen.
You can make your TextView
invisible when you spend a few seconds with the help of TimerTask
:
Timer t = new Timer(false);
t.schedule(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
public void run() {
tvdato.setVisibility(View.INVISIBLE);
}
});
}
}, 5000); //5000 equivale a 5 segundos (en milisegundos)
On the other hand, I think the most useful thing to show a message for a few seconds on the screen, is to use a Toast
:
Toast toast1 = Toast.makeText(getApplicationContext(),"BIEN", Toast.LENGTH_SHORT).show();