Apr 7 | 7:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Suzanne A. | has entered the room |
Mark M. |
howdy, Suzanne!
|
Suzanne A. |
hallo (again) got your chapter on fragments
|
Suzanne A. |
have a question about your comment on same fragments for different orientations
|
Mark M. |
OK
|
Suzanne A. |
is there any workaround?
|
Apr 7 | 8:00 PM |
Mark M. |
hmmm...thought I covered that somewhat
|
Mark M. |
the best workaround is a FragmentTransaction
|
Mark M. |
but that's a bit beyond what I want to cover in that chapter
|
Mark M. |
I'll be covering it in the Advanced Android book shortly
|
Suzanne A. |
ok, i've only read through page 389 .. sorry
|
Suzanne A. |
is it possible to tap a fragment, or ui control in a fragment, and show or hide it?
|
Mark M. |
lacking that, the next-best workaround is to make the unnecessary fragment's view gone, which is what I'm doing in EU4You_6
|
Mark M. |
you can't hide a fragment, but you can hide its View
|
Mark M. |
which amounts to the same thing from a UI standpoint, AFAICT
|
Suzanne A. |
yes
|
Mark M. |
again, FragmentTranscation is the right way to accomplish it
|
Suzanne A. |
and EU4You_6 does that already? please excuse that I didn't finish the chapter yet
|
NetApex | has entered the room |
fitz | has entered the room |
Mark M. |
EU4You_6 takes the hide-the-unnecessary-fragment's-view approach
|
Mark M. |
(btw, howdy NetApex and fitz!)
|
NetApex |
Hey there Mark
|
Suzanne A. |
ok. I'll go back and look more
|
fitz |
hello
|
Mark M. |
I am sure that there are gaps that I need to close in that chapter, so I am certainly up for suggestions
|
Suzanne A. |
okay. will finish it on the plane tomorrow, and lyk
|
Mark M. |
NetApex: do you have a question?
|
Apr 7 | 8:05 PM |
NetApex |
Working with an array... kicking my butt trying to get the view correctly
|
NetApex |
I have a runnable and when the array gets the data
from the Internet and tries to update the view it can't because it is
not the main ui
|
NetApex |
I am trying to figure out how to set the adapter correctly basically
|
Mark M. |
personally, I'd use an AsyncTask, with the background work in doInBackground() and the adapter-update in onPostExecute()
|
Mark M. |
if you want to stick with your existing code, just wrap your adapter-update logic in a Runnable and call post() on some View
|
Mark M. |
or runOnUiThread() on your activity
|
NetApex |
does AsyncTask give you the option of showing a progress indicator of some sort?
|
Mark M. |
sure
|
Mark M. |
doInBackground() can call publishProgress()
|
NetApex |
Ok then that is the direction I shall head
|
Mark M. |
that routes to your onProgressUpdate() method on the AsyncTask
|
Mark M. |
which is called on the main application thread
|
NetApex |
Ahh ok cool
|
Mark M. |
I have examples of it in the threading and rotation chapters of The BCG to Android Development.
|
Mark M. |
fitz: do you have a question?
|
fitz |
na just getting more coffee so I can concentrate on topics :)
|
Apr 7 | 8:10 PM |
Mark M. |
OK
|
fitz |
been a LOOOOONNNNGGGGG day
|
Mark M. |
Suzanne: got another question?
|
Mark M. |
OK, if anyone has a question, chime in
|
NetApex |
I have another related question then
|
Mark M. |
go right ahead
|
NetApex |
ArrayList.. where do I make a change in the spacing of the lines?
|
Mark M. |
ArrayList doesn't have lines
|
Mark M. |
do you mean the rows created by your ArrayAdapter?
|
NetApex |
Err, yeah sorry about that
|
Suzanne A. | has left the room |
Mark M. |
I think there's an attribute on TextView, hold on...
|
Mark M. |
android:lineSpacingExtra
|
Mark M. |
or android:lineSpacingMultiplier
|
NetApex |
Is there by chance a "word wrap" type function too?
|
Mark M. |
that's built in
|
Mark M. |
it automatically wraps
|
Apr 7 | 8:15 PM |
NetApex |
Hmm, okay cool
|
Mark M. |
you may need to adjust android:minLines, android:maxLines, or android:lines to suit
|
NetApex |
Ok
|
NetApex |
That gives me plenty to start from
|
Suzanne A. | has entered the room |
Apr 7 | 8:20 PM |
Mark M. |
welcome back, Suzanne!
|
Apr 7 | 8:20 PM |
Suzanne A. |
thanks
|
Suzanne A. |
I just came back to say .. it does, I found it
|
Suzanne A. |
sorry I didn't see it sooner :-)
|
Mark M. |
what does what?
|
Suzanne A. |
EU4You detects orientation and hides a view
|
Mark M. |
ah, yes
|
Suzanne A. |
I'm just moving too fast these days
|
Mark M. |
nah, that's just the jet lag talking
|
Suzanne A. |
okay. we'll tweet you from berlin and london
|
Mark M. |
thanks!
|
Suzanne A. |
danke, and see you soon :-)
|
Suzanne A. | has left the room |
NetApex |
So, Google I/O, are you going?
|
Mark M. |
scheduled to, yes
|
NetApex |
Cool, I want to get the chance to shake your hand for the helo!
|
NetApex |
err.. help
|
Mark M. |
that could be challenging, with ~8,000 attendees
|
Mark M. |
I|O isn't CES, but it's still a pretty big crowd
|
Apr 7 | 8:25 PM |
NetApex |
Hehe, yeah... just look for the Android fan lol
|
Mark M. |
again, if anyone comes up with a question, just ask
|
NetApex |
Alright, so I have adapter that I want to post end layout...
|
NetApex | |
Apr 7 | 8:30 PM |
Mark M. |
"post end layout"?
|
NetApex |
Where do I place that part of the code?
|
Mark M. |
on the main application thread
|
NetApex |
(man, I am typing bad tonight)
|
Mark M. |
so, if you're using an AsyncTask, that feels like onPostExecute()
|
NetApex |
so I have to pass the items to the onPostExecute() call then?
|
Mark M. |
well, onPostExecute() needs them somehow
|
Mark M. |
option #1: return the items from doInBackground(), and get them as a parameter to onPostExecute()
|
Mark M. |
option #2: put the items in a data member of the AsyncTask in doInBackground(), then access the data member in onPostExecute()
|
Mark M. |
option #3: just generate random garbage for the data in onPostExecute() and hope the user doesn't notice
|
Mark M. |
:-)
|
NetApex |
lol
|
NetApex |
seems option #2 might be the one I will shoot for
|
NetApex |
Essentially, I will be gathering post from a site
and enabling a mobile view, so having something local and possibly in a
sql stae may be good
|
Apr 7 | 8:35 PM |
Mark M. |
"a sql stae"?
|
NetApex |
dear lord!! sql state
|
Mark M. |
you really need to cut back on the bourbon when you're on these chats... :-)
|
NetApex |
I have been limiting myself to two bottles lol
|
Mark M. |
if your data is in a SQLite database, rather than
converting the data into objects in an ArrayList, you might consider
just using a CursorAdapter or SimpleCursorAdapter
|
NetApex |
well currently it isn't, but I had thought of placing it into one just in case the user doesn't always have a network connection
|
Mark M. |
depending on the data format, it may be simpler
just to cache the downloaded file, rather than fuss with pouring it into
a database
|
Mark M. |
it all really depends on what you're trying to do
|
NetApex |
Hmmm, interesting idea
|
Apr 7 | 8:40 PM |
NetApex |
It's only post from a website, to title, an occasional image, and some text
|
Mark M. |
you're downloading this as... HMTL?
|
Mark M. |
er, HTML?
|
NetApex |
no, json
|
Mark M. |
oh, yeah, I'd seriously consider just hanging onto the file
|
NetApex |
ok I will take that advice
|
Mark M. |
assuming the objective isn't for the user to
modify the data offline, for something that small, parsing the JSON
probably won't be any slower than querying a database, and it can
simplify your code by not bothering with SQLite
|
NetApex |
I am all for simple code
|
NetApex |
ok thanks, I will get started, thanks!
|
Apr 7 | 8:45 PM |
fitz |
cya
|
fitz | has left the room |
Apr 7 | 8:55 PM |
Mark M. |
any last questions?
|
Apr 7 | 9:00 PM |
Mark M. |
ok, that's a wrap then
|
Mark M. |
two more chats next week
|
Mark M. |
have a pleasant day!
|
NetApex | has left the room |
Mark M. | turned off guest access |