Jan 31 | 3:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Jan 31 | 4:45 PM |
Brent K. | has entered the room |
Brent K. |
Hi Mark
|
Mark M. |
howdy, Brent!
|
Mark M. |
how can I help you today!
|
Mark M. |
er, ?
|
Brent K. |
I wanted to talk about adapters
|
Brent K. |
More specifically, which kind would be best for my app
|
Brent K. |
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
|
Brent K. |
so obviously not a db
|
Brent K. |
which nixes cursor adapters
|
Yash P. | has entered the room |
Jan 31 | 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
|
Mark M. |
but your own BaseAdapter is certainly another possibility
|
Mark M. |
(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)
|
Mark M. |
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.
|
Brent K. |
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)
|
Mark M. |
Yash: there is no fixed limit for how much data you store in getCacheDir()
|
Mark M. |
however, bear in mind that the user, and some apps, can purge your cache
|
Mark M. |
and, many devices have very limited internal storage, which is where getCacheDir() goes
|
Mark M. |
if you want to have a lot more than 1MB, please consider using getExternalCacheDir()
|
Jan 31 | 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
|
Mark M. |
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
|
Mark M. |
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
|
Mark M. |
there are methods on the Environment class to let you know the current status
|
Mark M. |
this problem goes away on Android 3.0+, thankfully
|
Yash P. |
Yes. I encountered this problem.
|
Yash P. |
Mark, is there some documentation that I could read on caching?
|
Mark M. |
not specifically on caching
|
Mark M. | |
Mark M. |
that page is generally on data storage
|
Jan 31 | 5:00 PM |
Mark M. |
OK, that is it for today's chat
|
Mark M. |
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 |