Really? It will be interesting to hear Google engineers comment on this. -----Original Message----- From: skink <[email protected]> To: Android Developers <[email protected]> Date: Thu, 2 Jul 2009 23:57:41 -0700 (PDT) Subject: [android-developers] **never ever** use Toasts with Activity context
> > hi, > > take NotifyWithText api demo as example. > > add in the begging of onCreate System.gc() and some logs with > getInstanceCount() and try to show any Toast, then exit NotifyWithText > demo. run it again - you will see getInstanceCount() increases leaking > Activities. repeat running demo couple of times. counter still > increases. > > now change context passed to Toast.makeText() by > adding .getApplicationContext() - now getInstanceCount() always shows > 5. > > so beware with Toasts - always use app ctx > > thanks > pskink > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

