Set Toast Appear Length

I found a solution to this by calling toast.cancel() after a certain delay that is shorter than the standard toast duration.

        final Toast toast = Toast.makeText(ctx, "This message will disappear in 1 second", Toast.LENGTH_SHORT);;

        Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
               public void run() {
        }, 1000);

Leave a Comment