Aug 23 | 3:50 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Aug 23 | 4:35 PM |
Ryan S. | has entered the room |
Mark M. |
hello, Ryan!
|
Mark M. |
how can I help you today?
|
Ryan S. |
Hi Mark, just bought the book!
|
Mark M. |
thanks! :-)
|
Ryan S. |
I don't have the code on me right now, so i'll have to just describe the issue
|
Mark M. |
these office hours are held usually three times a week
|
Mark M. |
go right ahead
|
Ryan S. |
I have an CoordinatorLayout, AppBarLayout and a ViewPager
|
Ryan S. |
and that combination works well when I have a list of some sort in the viewpager
|
Aug 23 | 4:40 PM |
Ryan S. |
but when I tried a view that was relatively static (google map) it basically got pushed down below the navigation bar
|
Ryan S. |
could just see the top of the zoom button poking out
|
Mark M. |
well, I have never used CoordinatorLayout nor AppBarLayout
|
Mark M. |
I seem to recall that those things were specifically designed with vertically-scrolling content in mind
|
Ryan S. |
That makes a lot of sense, i think it was created automaticlly by one of the new activity wizards
|
Mark M. |
yeah, if you leaf through the book, you'll find that I am not a fan of those wizards
|
Mark M. |
people think that they represent best practices
|
Mark M. |
in reality, they represent stuff that Google wants to promot
|
Ryan S. |
oof, that includes me
|
Mark M. |
er, promote
|
Ryan S. |
Got time for one more?
|
Mark M. |
with a particular emphasis on "lets all do lots of Material Design stuff before we figure out how 'Hello, world' works!"
|
Mark M. |
sure, it's a quiet chat room today
|
Mark M. |
if there are several people, I rotate among them to give everyone a shot
|
Aug 23 | 4:45 PM |
Ryan S. |
This one is from my old school project last term, basically the issue was that my app would crash if you rotated the screen while doing a network request
|
Ryan S. |
I think it had to do with the activity being recreated
|
Mark M. |
activities are destroyed and re-created by default on a configuration change
|
Mark M. |
where rotating the screen is perhaps the most common such change
|
Ryan S. |
I'm just not sure how you're supposed to update the reference to the activity in an asynctask while it's running
|
Mark M. |
you don't
|
Mark M. |
you keep the AsyncTask loosely coupled to whatever is consuming the results of the work
|
Mark M. |
one common approach is to use a retained fragment to manage the task
|
Mark M. |
Android already is responsible for keeping the fragment up to date with respect to what the current activity instance is that manages the fragment
|
Mark M. |
so long as your AsyncTask does not try touching the activity in doInBackground(), by the time onPostExecute() is called, the task can work with the fragment (and, by extension, the activity) without issue
|
Ryan S. |
alright, interesting
|
Ryan S. |
Thank you very much
|
Mark M. | |
Mark M. |
that's my main AsyncTask sample app from the book, covered in the chapter on threads
|
Mark M. |
it implements the retained fragment approach
|
Ryan S. |
I am very impressed with how often I find your answers to questions I find on StackOverflow
|
Mark M. |
yeah, I type a lot :-)
|
Ryan S. |
Well, I'm going to be reading through a chapter or two tonight, thanks for the pointers
|
Ryan S. |
Maybe see you again soon
|
Mark M. |
the calendar of upcoming chats is on the Warescription site
|
Aug 23 | 4:50 PM |
Mark M. |
and transcripts get posted to https://commonsware.com/office-hours/
|
Ryan S. | has left the room |
Aug 23 | 5:00 PM |
Mark M. | turned off guest access |