Skip to content Skip to sidebar Skip to footer

How To Toast A Message For A Specific Time Period?

I have made some code for my google map, where I position the camera to one place when the camera is positioned to the first place I toast a message and then I move the camera to a

Solution 1:

Try this surely it will help you i already tried it

   final Toast toast = Toast.makeText(getBaseContext(), "YOUR MESSAGE",Toast.LENGTH_SHORT);
                        toast.show();
                        new CountDownTimer(10000, 1000)
                        {
                            public void onTick(long millisUntilFinished) {toast.show();}
                            public void onFinish() {toast.cancel();}
                        }.start();

got the answer from this question please refer for full details

http://stackoverflow.com/questions/2220560/can-an-android-toast-be-longer-than-toast-length-long

Solution 2:

You'll need to subclass the Toast class and use it. The default class has just two values. Even if you pass a longer time duration, it will we reverted to either of SHORT or LONG


Solution 3:

And this is your toast message in the 1000 is 1 seconds and then that 3rd position is the timing of your toast and then you can show te toast for 10 seconds ...

   Toast.makeText(getBaseContext(), " This message for 10 seconds.", 10*1000).show();

Post a Comment for "How To Toast A Message For A Specific Time Period?"