Office Hours — Today, March 15

Tuesday, March 13

Mar 15
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
Tom O.
has entered the room
Mark M.
howdy, Tom!
how can I help you today?
Tom O.
Hello!
Today I am curious about In-App Billing, and a bit about fragments.
Mark M.
can't help you much with in-app billing
fragments, you may have better luck
Tom O.
Bummer. But, that does seem to be a common theme. In-App billing seems a bit to new.
Mark M.
I just have zero experience with it
and probably never will
4:00 PM
Mark M.
I can't just create some fake app and charge people for it, to learn how the billing works... :-)
Tom O.
Ah, well, no matter. I'll figure it out.
:)
So on to fragments then.
I have an activity with a fragment.
Well to be specific, my layout for the activity that has a FrameLayout
MyActivity.OnCreate will load fragment1 when in landscape, and fragment2 when in portrait.
So, when the app starts on my Xoom, it will probably load fragment1, as my Xoom is in landscape.
Now I rotate my Xoom 90 degrees.
Ron T.
has entered the room
Tom O.
I though that when the activity is destroyed and then recreated, that fragment1 would disappear from the FrameLayout
and that OnCreate would then add fragment2
Mark M.
and, let me guess: you get both fragments
(BTW, howdy, Ron!)
Tom O.
Yes.
Hello Ron.
Ron T.
Hi!
Mark M.
been bit by that myself
Tom O.
The fragments are one atop the other.
Mark M.
that's because that's the layout rule for FrameLayout
Tom O.
oh?
Mark M.
the stacking, I mean
FrameLayout puts everything in the upper-left corner, but later children float over top earlier children on the Z axis
4:05 PM
Tom O.
But I thought rotatiing the device would causes the Activity to be destroyed?
Mark M.
quoting from _The Busy Coder's Guide to Advanced Android Development_...
View paste
"If the savedInstanceState parameter is not null, though, then our activity
was recreated as a result of some configuration change or similar event. In
that case, Android is responsible for handling the fragments from the
previous activity instance, so we can skip initializing another one."
(page 186)
basically, in a configuration change, Android tries to reconstitute your previous set of fragments
Tom O.
ah. THat makes snese.
Mark M.
is there a particular reason why you have separate fragments for portrait vs. landscape?
Tom O.
Not a good reason.
Mark M.
you are probably better served trying to make them be the same fragment
Tom O.
I was demonstrating fragments to someone.
Mark M.
ah
Tom O.
and was showing transactions.
Mark M.
also ah
Tom O.
Then they rotated the device.....
Mark M.
you are welcome to keep them separate, but you'll need to alter your transactions (e.g,. replace() instead of add())
Tom: we can follow up on this in a bit
Ron: do you have a question?
Tom O.
Sure.
Ron T.
Yes, simple quick question on Webview...
I've built a simple Activity and it displays the URL fine...
Does the .loadURL method have to be executed in a background thread?
Mark M.
no
in fact, I'm not sure if it works in a background thread
Ron T.
So the method does the http on its own in the background?
4:10 PM
Mark M.
yes
WebKit has its own thread pool for this sort of thing
little, if anything, inside a WebView actually occurs on the main application thread, AFAICT
Ron T.
Great, I've got more to do with this project but that is my only question for now. I'll be working over the weekend and will no doubt have more questions next week. Thanks! over and out.
Mark M.
OK
Ron T.
has left the room
Mark M.
Tom: do you have another question?
(besides how on Earth #16 UNC Asheville can be up by 5 over #1 seed Syracuse?)
Tom O.
No. that is basically it. Just didn't get why the fragments were stacking
Ummm actually that question never entered my mind. :)
Thanks for the answer.
Mark M.
I basically pay attention just for the massive upsets :-)
sure, no problem
Tom O.
Have a good day. Now off to figure out in-app billing.
Mark M.
best o' luck!
4:30 PM
Tom O.
has left the room
4:35 PM
Raza
has entered the room
Mark M.
howdy, Raza!
how can I help you today:?
(give or take a colon)
Raza
Hello mark
Can you tell how i can create the MWC Android app layout? check screenshot here http://i.imgur.com/2xZAI.png
Mark M.
the top half is probably just an ImageView
4:40 PM
Mark M.
the bottom half is either a TableLayout or perhaps a dashboard
Raza
and in downside?
Mark M.
Raza
can i create that layout in GridView ?
Mark M.
that does not look like a GridView
though you could use one, I suppose
Raza
aww thanks for the post link
very helpful
Mark M.
GridView is typically used where there is an indefinite number of items, not a fixed half-dozen
the link is to a DashboardLayout, derived from the Google I|O conference app (iosched)
Raza
yeah just downloaded iosched application
one more thing TableLayout is good for multiple screen size?
Mark M.
that depends a bit on what you are putting in the TableLayout, and where the TableLayout is going
the existence of android:stretchColumns and android:shrinkColumns helps
but that's mostly for small changes in size (e.g., 3.5" phone to a 4.5" phone)
if you are thinking phones versus tablets, you might wind up using TableLayout in a fragment
but on a tablet, you probably have multiple fragments at once
Raza
thanks, i've to keep these thing in mind, i find that building UI is more difficult in Android
4:45 PM
Raza
Any idea about external library where i can find Actionbar & ViewPager in same library ?
Mark M.
I doubt any such library exists
ViewPager is part of the Android Support package
the action bar is part of native Android (API Level 11+)
you will find some action bar equivalents for earlier Android versions, like ActionBarSherlock
Raza
i mean ViewPager+ tabs generally we seen such thing in ICS
Mark M.
even still, there is unlikely to be a single library that has both of your requested items
it is akin to seeking a library that offers language translation and an RPN calculator
they just are not that related
so it is unlikely any developer combined them into one library
Raza
ok
Mark M.
with respect to ViewPager and tabs, the standard solution is PagerTitleStrip
though that is not interactive (shows labels, but they are not clickable)
4:50 PM
Mark M.
I have not run across a ViewPager + tabs solution, but I have not been actively looking for one yet
Raza
Actually this looks really neat in Apps
i seen Viewpager+ tabs in many apps
Mark M.
oh, it looks good -- just not quite certain how they are implementing it, that's all
Raza
Any good tool for wire framing ?
Mark M.
I do not wireframe, so I cannot answer that, sorry
Raza
If i'm not wrong you're going to combine 4 books in single one?
Mark M.
that is correct
Raza
any idea when you're going to release and yes please release print edition too
Mark M.
the "omnibus" (combined) edition is slowly rolling out now
you will see Version 0.1 on your Warescription page in EPUB format
with luck, it will be completed in May
I have no current plans for updating print editions, since 90+% of the readers go with the digital subscription
4:55 PM
Mark M.
I will likely do *something* in print, but exactly what and when, I do not know
Mark M.
that's a wrap for today's chat
Raza
Bye
Mark M.
next one is Tuesday at 7:30pm Eastern
have a pleasant day!
Raza
has left the room
Mark M.
turned off guest access

Tuesday, March 13

 

Office Hours

People in this transcript

  • Mark Murphy
  • Raza
  • Ron Thomas
  • Tom Opgenorth