Search code examples
androidtoastduration

Set Android Toast duration to be really long (e.g., 1 minute)


I try to set my Toast show duration like 1minute. I try this:

  final Toast toast = Toast.makeText(getApplicationContext(), "MESSAGE", Toast.LENGTH_LONG );
  toast.show();

    Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
               @Override
               public void run() {
                   toast.cancel(); 
                   }
            }, 60000);

Thanks for your help.


Solution

  • Since LENGTH_SHORT is 2 seconds (and LENGTH_LONG is 3.5 seconds), try this:

    for (int i=0; i < 30; i++)
    {
        Toast.makeText(this, "MESSAGE", Toast.LENGTH_SHORT).show();
    }