Sunday, March 13, 2011

Re: [android-developers] Re: Global Variables

That's strange, it works for me.

On Sat, Mar 12, 2011 at 11:42 PM, Indicator Veritatis <mej1960@yahoo.com> wrote:
I get "no such project" when I try to go to your link.

On Mar 12, 1:05 am, Dianne Hackborn <hack...@android.com> wrote:
> Oh good lord, there is nothing intrinsically evil about globals or
> singletons.  Just don't abuse them.
>
> For example, say I want to do a query on the package manager about a set of
> applications that are available.  If I stick this as local data inside of a
> particular activity, then every time the user presses back and returns to
> the activity the state needs to be reloaded, and if I want to share that
> state with another activity I need to figure out some way to get the object
> over to the other activity without using an evil global.
>
> Just use a singleton and a global.  It's the appropriate tool for this.
>  Like the current code here in Manage Applications, which works 10x better
> in gingerbread because it was refactored to have a cleanly controlled
> singleton that tracks everything that needs to be known about the installed
> applications across all parts of the UI:
>
> http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;...
>
> On Fri, Mar 11, 2011 at 9:21 PM, Brill Pappin <br...@pappin.ca> wrote:
> > Singleton is also one to be avoided however... just like global vars :)
> > However, as we're working on a (sort of) limited device, Singletons are a
> > way of life.
>
> > --
> > 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
>
> --
> 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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



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

No comments:

Post a Comment