Just as the title says. I’m trying to have display a Toast text when a button is clicked, and then close the application after the message disappears.
Toast toast = Toast.makeText(getApplicationContext(), "Message here", Toast.LENGTH_SHORT);
toast.show();
finish();
This closes the application as the toast message displays and I was just wondering if I could delay closing the application to after the message disappears.
Thanks!
You will have to set a timer for the time it takes the toast to disappear.
If I’m not mistaken, LENGTH_SHORT is 2 seconds or around it.
Call a timer with a timer task with a 2 seconds delay that will call finish in turn.