tags:

views:

17

answers:

1

I want to display a text for two seconds that tells the user that he has made a mistake. I want the behavior of an popup behavior of an AlertDialog. However the alert should close automatically after two seconds and accept no on screen clicks that close it.

What class should I use?

+1  A: 

If you're just looking to pop up a quick notification, you could use a Toast.

Quick example (from the link above):

Context context = getApplicationContext();
CharSequence text = "An error has occured";
int duration = Toast.LENGTH_SHORT;

Toast toast = Toast.makeText(context, text, duration);
toast.show()
eldarerathis
Toast could do something similar. It however doesn't draw enough visual attention to give the user clear feedback that he made an error.
Christian
In that case, an AlertDialog *can* have zero buttons if you want. You'd have to create a timer of some sort to dismiss it, then, obviously.
eldarerathis