Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Application & ApplicationContext
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bkbonner  
View profile  
 More options Aug 13 2009, 1:47 pm
From: bkbonner <brian.bon...@paraware.com>
Date: Thu, 13 Aug 2009 10:47:04 -0700 (PDT)
Local: Thurs, Aug 13 2009 1:47 pm
Subject: Application & ApplicationContext
Diane (Hackborn), you posted the following:

Since activities are the things that interact with the user, they are
the
only things that can directly show UI.
The Application class exists because my arms were twisted into making
it.
There is nothing actually all that useful about it, as far as I am
concerned. ;)

We have several proxy interfaces where we make calls to backend
services -- I thought a specialized extension of Application would be
useful to hold these proxies as well as a client interface where we
make the call, to reduce the number of objects being created and
cutting down on Garbage Collection.  A singleton if you will.  Is this
an erroneous assumption?

I also was using the Application as a location to fire off a thread to
load globally accessible data needed by the application -- should I
move these into an Activity and store the data in the sqllite?  It
seems like a lot more work to store them in a database if I'm just
going to query them the next time the app pulls them down.  I plan to
write a mechanism to sync the data to local sqllite in the future, I'm
just short on time.

I'm currently running into a problem where I'm getting an NPE back
from a subsequent activity where this data is not found--even though I
saw it being loaded in my Application subclass and stored there.
Weird.

Brian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dianne Hackborn  
View profile  
 More options Aug 13 2009, 2:52 pm
From: Dianne Hackborn <hack...@android.com>
Date: Thu, 13 Aug 2009 11:52:54 -0700
Local: Thurs, Aug 13 2009 2:52 pm
Subject: Re: [android-developers] Application & ApplicationContext

I generally recommend just doing singletons in statics rather than making a
custom Application class.  To me it seems easier, and avoids issues in the
future when you are breaking an app apart or combining apps together or
other kinds of refactoring where having a bunch of stuff in a global
Application class gets annoying.

Also using static singletons tends to encourage people more to do lazy
initialization, rather initializating a bunch of stuff when an Application
class is created which can significantly impact startup time.

On Thu, Aug 13, 2009 at 10:47 AM, bkbonner <brian.bon...@paraware.com>wrote:

--
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »