Tuesday, March 1, 2011

Re: [android-developers] Toast not disappearing

Julius,

You mentioned IntentService, which runs your code on a background thread.

Even though Toast can supposedly be shown from any thread, I'd try
changing the code so that you show the toast from the UI thread. That's
easy to do with a Handler and a small Runnable subclass.

-- Kostya

01.03.2011 10:06, Julius Spencer пишет:
> Unfortunately that didn't work. In on Destroy() I put in:
>
> System.out.println("Duration: "+toastMessage.getDuration());
> toastMessage.cancel();
>
> (where toastMessage was assigned any toastMessage I'd created and shown)
>
> and I got:
> Duration: 0
>
> Not sure if that is of any use. I've never had any trouble with Toasts (except not calling show() :) ). I'm a bit stumped.
>
> Regards,
> Julius.
>
>
> On 1/03/2011, at 7:50 PM, Julius Spencer wrote:
>
>> Yeah it's definitely being hit just once (I put a break point in).
>>
>> I'll try out dismissing it if the IntentService is destroyed.
>>
>> Thanks for the replies everyone.
>>
>> Regards,
>> Julius.
>>
>>
>> On 1/03/2011, at 4:15 PM, TreKing wrote:
>>
>>> On Mon, Feb 28, 2011 at 8:53 PM, Julius Spencer<julius@msa.co.nz> wrote:
>>> I'm sure it's just something I'm not thinking of but I'm stumped...
>>>
>>> You're not calling it over and over again are you?
>>>
>>> -------------------------------------------------------------------------------------------------
>>> TreKing - Chicago transit tracking app for Android-powered devices
>>>
>>>
>>> --
>>> 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+unsubscribe@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en


--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment