Mar 17 | 9:50 AM |
Mark M. | has entered the room |
Mar 17 | 9:55 AM |
Mark M. | turned on guest access |
Mar 17 | 10:00 AM |
Thierry-Dimitri R. | has entered the room |
Mark M. |
howdy, Thierry!
|
Thierry-Dimitri R. |
Hi Mark
|
Mark M. |
how can I help you today?
|
Thierry-Dimitri R. |
I have a question for you: I'm building a news
application. I download image for each news item that I stored on the sd
card to fetch them later. I do not want to fill up 100 megs on the sd
card. When would be the appropriate them to clean those that are more
that 1 day old? Do an AsyncTask when my main activity onCreate is
called? onDestroy()? Or setup an Alarm task during the night?
|
Mark M. |
when are you doing the downloads?
|
Mar 17 | 10:05 AM |
Dimitri | has entered the room |
Thierry-Dimitri R. |
during the onCreate(), I start an AsyncTask to get
the last 25 items, which I store into a list. This list start other
async task to download the image when the user scrolls through the items
|
Dimitri |
Hello
|
Mark M. |
howdy, Dmitri!
|
Mark M. |
Thierry: I would recommend the nightly Alarm task, then
|
Mark M. |
no sense in adding more flash I/O than necessary right when the user is using the phone
|
Mark M. |
Dimitri: do you have a question?
|
Thierry-Dimitri R. |
That's what I thought. Thanks
|
Thierry-Dimitri R. |
Also, I really loved each of your AnDevCon presentation. Is there a screencast of your anti-pattern talk?
|
Dimitri |
Yes sorry was waiting for you to finish with Thierry
|
Mark M. |
Dimitri: no problem, but ask away!
|
Mark M. |
Thierry: no screencast, but the slides are up on https://commonsware.campfirenow.com/01de5
|
Thierry-Dimitri R. |
Thanks Mark
|
Mar 17 | 10:10 AM |
Dimitri |
I recently posted a question regarding Custom
Autocomplete and implementing Filterable i have seems to have solved
that problem.
|
Dimitri |
View paste
|
Mark M. |
what sort of adapter are you using for the 2nd AutoCompleteTextView?
|
Dimitri |
I posted a question on StackOverflow regarding update the underlying adapter but i have yet to receive an answer...
|
Dimitri |
sorry
|
Dimitri |
an ArrayAdapter<Object>
|
Mark M. |
OK, so when the user enters something into the 1st AutoCompleteTextView, call add() on the ArrayAdapter
|
Mark M. |
where specifically are you running into problems?
|
Mar 17 | 10:15 AM |
Mark M. |
while Dimitri ponders that...Thierry: do you have another question?
|
Tejas | has entered the room |
Mark M. |
howdy, Tejas!
|
Tejas |
Hi Mark !
|
Dimitri |
sorry i was reading about add() . This will Adds
elements at the end of the array. But i want to constantly refresh my
adapter list....
|
Mark M. |
Dimitri: Call add() on the ArrayAdapter. It will "automatically refresh [your] adapter".
|
Dimitri | |
Mar 17 | 10:20 AM |
Thierry-Dimitri R. | has left the room |
Mark M. |
I am going to try to handle both of your threads simultaneously -- Tejas: do you have a question?
|
Tejas |
nopes... but will just be passive until some question strikes me
|
Mark M. |
OK
|
Mar 17 | 10:25 AM |
Dimitri |
Sorry i have just realized that i have completely
mixed up my question... I am updating two things my
ArrayAdapter<Station> and my
CustomAutoCompleteAdapter<Station> both are used by the UI. One
for a dialog with alist of Station. The other for the autocomplete.
|
Dimitri |
is it possible to upload a snippet of code....
|
Dimitri |
i may not be explaining it well....
|
Mark M. |
I would recommend that you use a paste service like gist.github.com
|
Mark M. |
larger code listings sometimes get messed up when pasted directly into the chat
|
Mark M. |
you can paste in the link to the gist you put on gist.github.com
|
Dimitri |
wiil this do...
|
Dimitri | |
Mark M. |
OK, one moment while I read through that
|
Dimitri |
Thank you
|
Mark M. |
I really do not understand what you are trying to do in the two onItemClick() methods
|
Mark M. |
All you seem to do is load the same data back into the same AutoCompleteTextViews
|
Mark M. |
Oh, wait
|
Mark M. |
I understand a bit better
|
Mark M. |
when the user clicks on an AutoCompleteTextView entry, you are replacing the other adapter with a new list of stations, right?
|
Mar 17 | 10:30 AM |
Mark M. |
In answer to the question itself that you posed on StackOverflow, I do not see how else you could do it much more efficiently
|
Dimitri |
That is right...
|
Dimitri |
Also i am loading the List of Station on an
ArrayAdapter<Station> the is used in a Dialog the is triggered by a
button next to the auto-complete...
|
Mar 17 | 10:35 AM |
Mark M. |
Again, I think that the code that you have on
StackOverflow is as good as that is going to get, at least in terms of
your adapter management
|
Mark M. |
if you have other questions, feel free to ask
|
Mar 17 | 10:40 AM |
Dimitri |
Ok, Different question regarding Parcelable and Map.
|
Dimitri |
First is a good idea i am new to Android and what i have read so far Parcelable offers better performance than serializible?
|
Mark M. |
Parcelable is designed to convert objects to byte arrays for transport across process boundaries
|
Dimitri |
I have a object with a Map as a field.
|
Mark M. |
Serializable is designed to write objects out to streams to later be read in
|
Dimitri |
ok...
|
Dimitri |
I am using Parcelable to pass my object in an Intent: i.putExtra(MY_RESULT, result);
|
Mar 17 | 10:45 AM |
Tejas | has left the room |
Dimitri |
My "result" object has a Map<String, Parcelable<Object>> by implementing parceable i have to Override writeToParcel
|
Dimitri |
how do i actual write a Map?
|
Mark M. |
let's back up a step
|
Mark M. |
why are you trying to put this object into an Intent?
|
Dimitri |
So that i can read its values in the next activity and present them.
|
Mark M. |
then I think you have a design problem
|
Mark M. | |
victor | has entered the room |
Mark M. |
if the data model is that complicated, it should not be "owned" by any activity
|
victor |
hi
|
Mark M. |
the data model should be held outside of all activities -- Service, Application, static data member, something
|
Mark M. |
(btw, howdy, victor!)
|
victor |
:)
|
Mark M. |
Dmitri: if this were a Web app, and the two
activities were Web pages, you would not be trying to stuff this data
into some GET parameter
|
Mark M. |
Intent extras are equivalent to GET parameters
|
Mar 17 | 10:50 AM |
Mark M. |
all that being said, I have never implemented
Parcelable, so I have no idea how I would convert a Map<String,
Parcelable<Object>> as part of a Parcelable, sorry
|
Mark M. |
another possibility, if two activities have that
complicated of data to be shared between them, is that perhaps they
should not be two separate activities
|
Mark M. | |
Mark M. |
and since we're running out of time... victor: do you have a question?
|
Chris H. | has entered the room |
victor |
yes a small one
|
victor |
I have a webview that calls some native methods through a js interface
|
Dimitri |
thank you.
|
victor |
and I would like to know in Java the variable type that javascript is passing to my method
|
victor |
since javascript is not typed I just get Strings from the webview
|
Mar 17 | 10:55 AM |
Mark M. |
you will have to pass the data type as another parameter
|
Mark M. |
as you say, everything is a string
|
victor |
ok, I guess there is no other way
|
victor |
:)
|
Mark M. |
or, possibly, convert the data to JSON, and derive the type as part of parsing the JSON, but that seems like overkill
|
Mark M. |
Chris: do you have a question?
|
victor |
ok, thanks
|
Chris H. |
Mark, I was just popping in to see if you got any feedback on my hardware questions from Tuesday?
|
Mark M. |
ah!
|
Mark M. |
yes!
|
Mark M. |
bad news, though
|
Mark M. |
my contact didn't have great recommendations
|
Mark M. |
hold on while I pull up the email
|
Mark M. |
"In the end, the people who will do this are going
to be the silicon vendors, TI, broadcom, wondermedia, freescale. They
are the ones that have the incentive and the resources."
|
Mark M. |
he knew of no independent firms handling this sort of thing
|
Mark M. |
sorry!
|
Chris H. |
I see. Im not giving up hope yet. Honestly, I
think the silicon vendor already has support for what I need on the
linux layer, but there is no interface to it from Android. Mentor
Graphics did the Android port for my processor, so I am in discussions
with them. I just hope it doesn't cost us $50k. Thanks for the help.
|
Mar 17 | 11:00 AM |
Mark M. |
OK, that is all for today's chat
|
Chris H. | has left the room |
Mark M. |
the two next week are 8pm Eastern Time
|
Mark M. |
have a pleasant day!
|
Dimitri | has left the room |
victor | has left the room |
Mark M. | turned off guest access |