Nov 7 | 9:50 AM |
Mark M. | has entered the room |
Nov 7 | 9:55 AM |
Mark M. | turned on guest access |
Nov 7 | 10:00 AM |
Guy | has entered the room |
Guy |
Hello Mark ;)
|
Mark M. |
hello, Guy!
|
Mark M. |
how can I help you today?
|
Guy |
battling with the CursorAdapter
|
Guy |
what do i put as an int in the flags
|
Mark M. |
um, could you be a bit more specific? :-)
|
Guy | |
Mark M. |
pass whatever flags you need, or 0 if you do not need any
|
Mark M. |
the only non-deprecated flag is FLAG_REGISTER_CONTENT_OBSERVER
|
Mark M. |
and that is only relevant if you are using a ContentProvider as your data source and are not using a Loader
|
Guy |
when do I need to use a loader?
|
Guy |
sorry
|
Mark M. |
the Loader framework, for asynchronous queries (particularly of content providers), is covered in the book
|
Guy |
thanks
|
Nov 7 | 10:05 AM |
Guy |
the adapter is show the first few lines in the listview and spinner and then repeating them. only after I pull down the spinner does it refresh and show the whole list
|
Nov 7 | 10:05 AM |
Mark M. |
if you have another question, go ahead -- quiet chat room today
|
Guy |
thanks
|
Brett | has entered the room |
Brett |
Hi Mark
|
Mark M. |
Guy: I am sorry, but I did not understand your last comment. Let me take a question from Brett, and I will be back with you shortly.
|
Mark M. |
Brett: hi -- do you have a question?
|
Brett |
Yes Sir
|
Guy |
OK. is my adapter correct https://github.com/gywst/CurrencyExchange/blob/...
|
Brett |
I'm putting the finishing touches on an app that makes use of your Large-Screen Tablet tactic of using a single activity with a fragment for each screen
|
Brett |
which works very well by the way!
|
Nov 7 | 10:10 AM |
Brett |
At first, all of my fragment (screen) transactions where using "add", but I was hoping to visually make the previous screen slide out, so I changed the transactions to "replace"
|
Brett |
So I'm wondering does Android really treat the replaced fragments any differently after this change? I noticed that destroy still isn't called on the replaced fragment.
|
Mark M. |
replace() is a remove() and an add(), under the covers, AFAIK
|
Brett |
I was surprised that the replaced fragment still maintains it's state after popping the backstack
|
Brett |
(and returning to it)
|
Brett |
I am adding most screens to the backstack BTW for reverse navigation
|
Mark M. |
I do not recall having tried replace() *and* addToBackStack()
|
Mark M. |
I certainly do not remember the specifics about the expected behavior
|
Brett |
Yeah, the only reason I tried it was to get the nice slide out animation on the "replaced" screen
|
Nov 7 | 10:15 AM |
Mark M. |
sorry that I could not be of greater help on this one
|
Brett |
no worries, just thought I'd bounce it off ya
|
Mark M. |
OK
|
Mark M. |
Guy: with respect to your adapter, I do not think you need to call bindView() yourself in newView(), as that should be done for you
|
Mark M. |
you might also consider caching the result of the cursor.getColumnIndex() lookup calls, as those will not change for the life of the Cursor
|
Mark M. |
and I would probably set up a static HashMap<String, Integer> rather than use the big if-elseif chain for mapping the currency to its icon(?)
|
Mark M. |
beyond those, nothing leaps out at me as being specifically a problem with your adapter, at least from a quick inspection
|
Guy |
the icons are stored locally
|
Mark M. |
well, yes, they are resources
|
Mark M. |
still, I would use something a bit more declarative, rather than have the big if-elseif chain
|
Brett | has left the room |
Mark M. |
but that's just a personal style issue, as much as anything
|
Nov 7 | 10:20 AM |
Guy |
OK. although I never used a hashmap, I'll check your book. Thanks :-)
|
Mark M. |
if you have another question, feel free to chime in
|
Guy |
checking out the HashMap
|
Nov 7 | 10:25 AM |
Guy |
is there a reason why the listview and the spinner show results twice and when I pull down the spinner it get right list of results?
|
Mark M. |
I have no idea what Spinner you are referring to
|
Mark M. |
for that matter, I have no idea what ListView you are referring to
|
Guy | |
Guy |
the spinner and the listivew is here https://github.com/gywst/CurrencyExchange/blob/...
|
Mark M. |
you cannot use the same Cursor for two different purposes at once
|
Nov 7 | 10:30 AM |
Guy |
two spinners? or the listview and the two spinners
|
Mark M. |
well, either
|
Mark M. |
a Cursor has internal state that can cause problems if multiple parties are trying to use the Cursor at the same time
|
Guy |
so I should use an arrayadaper instead?
|
Mark M. |
converting your database results into a model ArrayList and using an ArrayAdapter is one possibility
|
Guy |
the app parses a xml from the internet and keeps it in the sqlite db.
|
Mark M. |
are you really using the database for anything other than retrieving all currencies?
|
Mark M. |
if not, I would consider just holding onto the XML
|
Nov 7 | 10:35 AM |
Guy |
downloading the xml once, and reading it again and again till it expires
|
Guy |
where and how do I store the XML?
|
Mark M. |
as a file
|
Mark M. |
using standard Java file I/O
|
Mark M. |
probably in internal storage (e.g., getFilesDir())
|
Guy |
and use the same xmlparser I built to readit?
|
Mark M. |
presumably
|
Nov 7 | 10:40 AM |
Guy |
:-)
|
Guy |
now I have to rewrite most of the app :-)
|
Guy |
Thanks.
|
Mark M. |
"The management question, therefore, is not whether to build a pilot system and throw it away. You will do that. […] Hence plan to throw one away; you will, anyhow."
|
Mark M. | |
Mark M. |
:-)
|
Guy |
I finished a very intensive mobile course a few months back Java, Android, Objective C and HTML5
|
Guy |
5 months 3 times a week.
|
Guy |
not enough
|
Nov 7 | 10:45 AM |
Guy |
Thank. that was helpful. see you soon :-)
|
Mark M. |
you're welcome!
|
Nov 7 | 10:50 AM |
Guy | has left the room |
Nov 7 | 10:55 AM |
Mark M. | turned off guest access |