On Fri, Jan 6, 2012 at 12:49 AM, galapogos <[email protected]> wrote:

> How do I cache?
>

Object item = Cache.getThing(idOfThingIWant);
if (item == null)
{
 item = loadTheLongSlowWay(idOfThingIWant);
 Cache.save(item);
}


> I did some investigation, and the steps that seem to
> take a lot of time is displaying of the app name/icon and whether it's
> a system app or not, i.e. getting the following results:
> 1. applicationInfo.loadLabel().toString()
> 2. applicationInfo.flags
> 3. applicationInfo.loadIcon()
>
> How do I cache when it's the first time that I'm running the app and it's
> generating a new list?
>

You don't the first time. You load it, then cache, so it's faster later.


> > The Tabs should be part of the same Activity, which would have one list
> > they both access.
> I see. Currently I have a main activity which extends a TabActivity
> class, and in it I have a few tabs, which extends ListActivity
> classes. So I should generate the app list in the TabActivity's
> onCreate() method, and access the list from the tabs?
>

I've never used TabActivity with child Activities but from everything I've
read around here, it's a major PITA and should be avoided. Use Views
instead of child Activities. Then, yes, you make your list in the activity
and access them in the views.

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/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 [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

Reply via email to