Office Hours — Today, January 31

Thursday, January 26

Jan 31
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:45 PM
Brent K.
has entered the room
Brent K.
Hi Mark
Mark M.
howdy, Brent!
how can I help you today!
er, ?
Brent K.
I wanted to talk about adapters
More specifically, which kind would be best for my app
I've been using an arrayAdapter so far, and in rummaging through the ICS email app, I've gotten to understand cursorAdapters
Mark M.
what is your data and where is it stored?
Brent K.
I'm making a file manager app
so obviously not a db
which nixes cursor adapters
Yash P.
has entered the room
4:50 PM
Brent K.
I was looking at OI file manager, and it uses a custom adapter that extends baseAdapter and implements filterable
Mark M.
if you are using methods like list() on File, I would think an ArrayAdapter would be good
but your own BaseAdapter is certainly another possibility
(btw, howdy, Yash!)
Yash P.
Hello!
Mark M.
Brent: is there a particular problem you have been encountering?
Brent K.
so is an array adapter pretty much just an adapter of a baseadapter?
Mark M.
ArrayAdapter inherits from BaseAdapter IIRC
Yash P.
Hey Mark, I have some questions on caching...
Mark M.
and, indeed, IDRC (I Do Remember Correctly)
Yash: go ahead, I'll try to handle you both in parallel
Brent K.
No particular problems, but I wanted to make sure I have the best adapter in place before I go building more code on top of it.
Wanted to make sure that there wasn't any common wisdom I was missing out on
Yash P.
The Android docs say that you have stay within a reasonable limit of space consumed, such as 1MB while caching. Can we go beyond this amount?
Mark M.
Brent: if your data model is an array, ArrayAdapter is certainly a reasonable solution, unless you specifically encounter problems (e.g., your array is too massive and can no longer be held in the heap)
Yash: there is no fixed limit for how much data you store in getCacheDir()
however, bear in mind that the user, and some apps, can purge your cache
and, many devices have very limited internal storage, which is where getCacheDir() goes
if you want to have a lot more than 1MB, please consider using getExternalCacheDir()
4:55 PM
Mark M.
at least on API Level 8
Yash P.
That was going to be my next question :)
Mark M.
but it's not like the phone will blow up if you use 1.1MB or something
you might also set up a manifest-registered BroadcastReceiver for ACTION_DEVICE_STORAGE_LOW, and trim your cache at that point
Yash P.
Are there any cons of using the External Directory?
Mark M.
on Android 1.x and 2.x, it is not always available
specifically, if it is mounted as a drive on a host PC, Android does not have access to it, and hence, neither does your app
there are methods on the Environment class to let you know the current status
this problem goes away on Android 3.0+, thankfully
Yash P.
Yes. I encountered this problem.
Mark, is there some documentation that I could read on caching?
Mark M.
not specifically on caching
that page is generally on data storage
5:00 PM
Mark M.
OK, that is it for today's chat
next one is Thursday at 10am Eastern
Yash P.
Thanks! Will catch you on Thursday.
Mark M.
have a pleasant day!
Brent K.
has left the room
Yash P.
has left the room
Mark M.
turned off guest access

Thursday, January 26

 

Office Hours

People in this transcript

  • Brent Kensey
  • Mark Murphy
  • Yash P