[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-12 Thread skink
On Jul 7, 5:32 pm, Romain Guy romain...@google.com wrote: Same thing, there is no leak. You have no guarantee in your test that the GC was run. It is important for the system_server process to be GC'd as well, which your test does not guarantee. i don't really understand the last sentence.

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-07 Thread Diego Torres Milano
This is fine. Thanks for the info. However, I've been writing some tests using ActivityInstrumentationTestCase2 and an Activity that depending on an extra parameter displays the Toast or not, and the results seems to be different. If the Toast is displayed the instance count constantly increases

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-07 Thread Romain Guy
Same thing, there is no leak. You have no guarantee in your test that the GC was run. It is important for the system_server process to be GC'd as well, which your test does not guarantee. On Tue, Jul 7, 2009 at 7:40 AM, Diego Torres Milanodtmil...@gmail.com wrote: This is fine. Thanks for the

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-07 Thread skink
On Jul 7, 12:27 am, Romain Guy romain...@google.com wrote: There is no leak, I just verified myself. Your call to System.gc() does NOT guarantee that the GC will run. To check for leaks here is the procedure: - Run the app - Run adb shell dumpsys meminfo | grep -A 12

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-07 Thread skink
On Jul 7, 4:49 pm, skink psk...@gmail.com wrote: I think if the references of my Activity were not kept by someone the system would gc() them during the allocation of field mNotUsedIntArray (when there is no available free memory), but it doesn't. probably its that *mysterious* system

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-07 Thread Dianne Hackborn
Um... a toast by definition sticks around for a while. If you are enqueing a bunch of toasts, they are all sticking around waiting to be displayed. They hold a reference on your context to load resources and such, so your context won't be released until all of the toasts are shown and dismissed.

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-07 Thread skink
On Jul 7, 6:38 pm, Dianne Hackborn hack...@android.com wrote: Um...  a toast by definition sticks around for a while.  If you are enqueing a bunch of toasts, they are all sticking around waiting to be displayed. They hold a reference on your context to load resources and such, so your

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-06 Thread skink
On Jul 3, 4:21 pm, skink psk...@gmail.com wrote: and since Toast internally uses notification service the same may apply to Notifications but i didn't check it yet thanks pskink i was quite busy during the weekend so i tested Notifications only now and it seems that they (or more

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-06 Thread skink
On Jul 3, 11:06 am, skink psk...@gmail.com wrote: On Jul 3, 11:20 am, hmmm akul...@mail.ru wrote: Really? It will be interesting to hear Google engineers comment on this. well, its nothing wrong with Toasts per se, they are working as api docs describe, but when using wrong context they

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-06 Thread skink
On Jul 6, 6:33 pm, skink psk...@gmail.com wrote: however i read Toast's api docs again and found that ctor and/or makeText can use Activity context... so now i'm a bit lost here: is it a bug in Toast or docs shoukd be updated? thanks pskink hi, is it possible that nobody uses Toasts?

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-06 Thread Romain Guy
There is no leak, I just verified myself. Your call to System.gc() does NOT guarantee that the GC will run. To check for leaks here is the procedure: - Run the app - Run adb shell dumpsys meminfo | grep -A 12 name.of.the.app.processs - Look at the count of Activities and ViewRoots - Run DDMS -

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread hmmm
Really? It will be interesting to hear Google engineers comment on this. -Original Message- From: skink psk...@gmail.com To: Android Developers android-developers@googlegroups.com Date: Thu, 2 Jul 2009 23:57:41 -0700 (PDT) Subject: [android-developers] **never ever** use Toasts with

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread skink
On Jul 3, 11:20 am, hmmm akul...@mail.ru wrote: Really? It will be interesting to hear Google engineers comment on this. well, its nothing wrong with Toasts per se, they are working as api docs describe, but when using wrong context they could give some problems...

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread hmmm
-developers] Re: **never ever** use Toasts with Activity context On Jul 3, 11:20 am, hmmm akul...@mail.ru wrote: Really? It will be interesting to hear Google engineers comment on this. well, its nothing wrong with Toasts per se, they are working as api docs describe, but when using wrong

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread skink
On Jul 3, 12:23 pm, hmmm akul...@mail.ru wrote: Is the following true: it is preferrable to always pass Applicatioon Context to any Toasts within the application? based on my latest test i made: yes, app context is only one so android 'leaks' only Application, but in fact its not leak

[android-developers] Re: **never ever** use Toasts with Activity context

2009-07-03 Thread skink
On Jul 3, 12:43 pm, skink psk...@gmail.com wrote: On Jul 3, 12:23 pm, hmmm akul...@mail.ru wrote: Is the following true: it is preferrable to always pass Applicatioon Context to any Toasts within the application? based on my latest test i made: yes, app context is only one so android