Toast.LENGTH_LONG and Toast.LENGTH_SHORT are not numbers of
milliseconds. If you print out the values you get:

Toast.LENGTH_LONG = 1
Toast.LENGTH_SHORT = 0

If you give a value other than 1 or 0, it seems to default to
LENGTH_SHORT.

Toast.LENGTH_LONG is ~4 seconds
Toast.LENGTH_SHORT  is ~2.5 seconds

Based on using a stopwatch and watching the emulator running on my
laptop.

On Jul 24, 3:13 pm, Scott <scott.mikoly...@gmail.com> wrote:
> Toast.LENGTH_LONG is only a constant number of milliseconds.  You can
> use any number of milliseconds if you like but there might be a
> maximum.
>
> Example:
> t.setDuration(999999999999);
>
> Scott
>
> On Jul 23, 10:31 pm, Mohamed Amir <mohamed.a...@gmail.com> wrote:
>
> > Thank you for all those who replied.
>
> > But Toast is the only UI component I could find that appears over the
> > incoming call dialog.  I need to show some information when an
> > incoming call arrives.  This is why I am using the Toast.
>
> > On Jul 24, 1:34 am, Dianne Hackborn <hack...@android.com> wrote:
>
> > > It sounds like you are abusing toasts.  How about just showing your own
> > > dialog that is set up to not get focus or be touchable?  You can use this
> > > background to make it look like a toast:
>
> > >http://developer.android.com/reference/android/R.drawable.html#toast_...
>
> > > And this animation style for the same fade effect:
>
> > >http://developer.android.com/reference/android/R.style.html#Animation...
>
> > > On Thu, Jul 23, 2009 at 8:17 AM, Mohamed Amir 
> > > <mohamed.a...@gmail.com>wrote:
>
> > > > Is there a way to make the Toast last for longer time?
>
> > > > I have tried this code
>
> > > >                        Toast t = new Toast(this);
> > > >                        View v = View.inflate(this, R.toast_layout, 
> > > > null);
> > > >                        t.setView(v);
> > > >                        t.setDuration(Toast.LENGTH_LONG);
> > > >                        t.show();
> > > >                        t.show();
> > > >                        t.show();
>
> > > > By calling show() method more than once, I hoped this would give a
> > > > similar effect to lasting for longer time with some flickering, but I
> > > > didn't see any difference.
> > > > Is there some limit to the number of times that show() method can be
> > > > called on the same Toast? e.g. just once per toast instance and
> > > > further calling has no effect?
>
> > > > Any ideas to increase that duration?
>
> > > > Thank you.
>
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > hack...@android.com
>
> > > Note: please don't send private questions to me, as I don't have time to
> > > provide private support, and so won't reply to such e-mails.  All such
> > > questions should be posted on public forums, where I and others can see 
> > > and
> > > answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to