Office Hours — Today, August 14

Tuesday, August 12

Aug 14
8:55 AM
Mark M.
has entered the room
Mark M.
turned off guest access
Mark M.
turned on guest access
Ron B.
has entered the room
9:00 AM
Mark M.
hello, Ron
how can I help you today?
Ron B.
Hi Mark, Is there a way to know if a map will come up slowly? I read the map perf. is based on available memory. I would like the user to see his current gps location on his main activity scree.
But not if it impacts getting the rest of the screen to display.
Mark M.
you have no good way of knowing if a map will come up slowly
that's going to be driven mostly by the quality of the Internet connection back to Google's map tile servers
memory may play a small part, but it will be dwarfed by the network I/O time
Ron B.
If the map is one view within my activity, would displaying that view with a background thread allow the user to see the other views in the interim?
Mark M.
well, you can't display a view in a background thread
and the Maps V2 API will usually crash quickly if you try doing much of anything on a background thread, in my experience
9:05 AM
Ron B.
Of course, I was looking for alternatives outloud :-)
Mark M.
however, the rest of the views should be showing up anyway
the actual fetching of the map tiles and off-process rendering of the bitmap that is the map is all asynchronous
you should see the typical gray "grid paper" in the meantime, wherever your MapView/MapFragment is
Ron B.
OK, I guess I'll play with that for a while and see how it flies. Thanks!
boomchaos
has entered the room
Mark M.
hello, boomchaos
boomchaos
Hi
9:10 AM
Mark M.
boomchaos: Ron has already asked a question, so it's your turn -- do you have a question?
boomchaos
I have a portrait layout and a landscape layout for a notification. When I'm in portrait and generate the notification it shows the portrait layout. When I'm in landscape and generate the notification, it shows the landscape layout. However, if I rotate the device after a notification has already been generated, the notification doesn't switch layouts. My xml layout for landscape is in layout-land so this should be working but it doesn't.
So my question is, why don't notifications switch to their proper layout on a configuration change?
Mark M.
that's up to the implementation of the notification stuff
boomchaos
And how can I get them to do so
?
Mark M.
you can't
ideally, you have one layout
the size may well be the same, portrait versus landscape
you're welcome to listen for ACTION_CONFIGURATION_CHANGED broadcasts and try updating your Notification in place with a new layout
boomchaos
ah, thanks, that would probably be the ideal solution
Mark M.
but I'd consider "portrait and landscape notification layouts" to be a bit of a code smell, as you're assuming size differences that may or may not exist
boomchaos
It's for a music playing app and the album art can probably be bigger in landscape than portrait
Mark M.
tablets, for example, usually have a fixed notification drawer width
9:15 AM
boomchaos
Oh, you're right about that then
Mark M.
then your album art ImageView should be using match_parent or something, rather than using a fixed size
there's nothing wrong with saying that your ImageView should take up more space when you have it, but you can't assume that you have more space just because of screen orientation
so, go with a more fluid layout that can adjust to available space better
admittedly, notification layouts may make this tricky
I haven't gotten too fancy with my notification layouts, even the Big styles
though I need to do a lot more in that area in the next couple of months
I'll try to make a point to examine this particular scenario and get it covered in the book as part of that work
boomchaos
Gotcha. Thanks for the help!
Mark M.
Ron: your turn -- do you have another question?
boomchaos
has left the room
9:25 AM
Mark M.
Ron: do you have another question?
9:30 AM
Ron B.
Sorry, no I'm all set. Thanks!
Mark M.
OK, just checking :-)
Ron B.
has left the room
10:00 AM
Mark M.
turned off guest access

Tuesday, August 12

 

Office Hours

People in this transcript

  • boomchaos
  • Mark Murphy
  • Ron Bruckman