Office Hours β€” Today, December 8

← Tuesday, December 1

Dec 8
1:50 PM
Mark M.
has entered the room
Dec 8
1:55 PM
Mark M.
turned on guest access
Dec 8
2:00 PM
Scott Q.
has entered the room
Scott Q.
Hi Mark
Mark M.
Hello!
Scott Q.
I have a basic layout question for you.
Scott Q.
The layout I'm trying to implement seems like it should be pretty commonplace, yet for some reason I cannot achieve the results I am after.
Alexadru B.
has entered the room
Scott Q.
Basically, I just want a container inside which I can programmatically add variably lengthed buttons in rows from left to right - if a button is too long to fit inside the container in the current row, it should appear as the first button in a new row below.
Scott Q.
View paste
I could write a custom view to do this but it seems like I am just not understanding the fundamentals...
Is something like this already supported?
Mark M.
Scott Quinney: no there is no layout that supports that concept
Mark
has entered the room
Mark M.
Hello, Alexadru B!
Mark
hello
Alexadru B.
Hi, I just wanted to stop by and see what others are having problems with
Alexadru B.
who knows when I may have the same problem :)
Mark M.
Hi, Other Mark!
Mark
hi Mark M
Mark
well, is it cool if I pose a question?
Mark
if nobody has started yet?
Dec 8
2:05 PM
Mark M.
@Mark: Scott asked a question, but I am not sure if he is done.
Mark
no prob, will wait my turn!
Scott Q.
yep, thats about it -- just not quite understanding how to achieve the described layout...
Scott Q.
seems like one that should already be written
Mark M.
Scott Quinney: Your question has come up on lists before, and there is no out-of-the-box solution
Scott Q.
ok -- good to know....just wanted to make sure there was some fundamental misunderstand I had before I write the view
Mark M.
Scott Quinney: If you pull it off, consider making it open source! I'm sure others would benefit.
Scott Q.
thanks for your help
Mark M.
@Mark: did you have a question?
Mark
yep - this should be a simple one - it's about Activities and launch modes
Mark
was looking through your book to see if there's info on this, maybe you know
Dec 8
2:10 PM
Mark
sorry, don't think my message got posted
Mark
my app has two activities, A and B
Mark
A can launch B from a simple button
Mark
when I install my app from marketplace or from the browser (as a raw apk file), I get a weird behavior
Mark
if market installer or browser installer opens my app, it runs fine - but if I hit the home screen key, then try to resume my app from the app tray
Mark
i will get two instances of my app running
Mark
and this actually happens with all apps I download from market place, that don't use the singleTask flag, I think
Mark M.
Hang on a second
Mark M.
I don't have my mail archives at the ready, but I've seen your posts on this topic, particularly if your last name begins with "Wy".
Mark
yep, that's me!
Mark M.
Unfortunately, I saw the posts and hoped you'd find an answer somewhere.
Mark
I know this is an eclipse "bug", but it seems that marketplace and browser installer use the same intent launching flag
Mark
ah ok no prob - that leads me to my follow up question then
Mark
do you find it better then to write an application using a single activity, if possible?
Mark
because in that case, I could simply use the singleTask flag to get around this issue
Mark M.
Uh, well, not really.
Dec 8
2:15 PM
Mark M.
The issue of how many activities to use is much bigger than how the initial launch after install behaves.
Mark M.
The last consulting gig I did had about a dozen activities, maybe more.
Mark
ok gotcha, thought maybe I was going crazy with that launcher behavior, and maybe everyone else was using single activities
Mark
it's just confusing for the user, I guess, but only really happens the first time they run the app
Mark
thanks
Mark M.
I'm sure many apps do use just one activity, but probably most of those don't have enough functionality to warrant more than one.
Mark M.
Did you get any answers from any Googlers on the issue?
Mark
none, there's a bug logged for the Eclipse launch issue, and I added a comment that marketplace/browser package installers use the same exact launch flags, and exhibit the same behavior
Mark M.
Do you have the issue number or URL handy?
Mark
yep, one sec let me grab it
Mark
someone just added a funny comment to it this morning
Mark
Dec 8
2:20 PM
Mark M.
You might consider opening a fresh issue on it. Normally, I don't advise that, but in this case, the market/browser install facet may get greater attention than the Eclipse facet.
Mark
good point, I'll do that - yeah I think most users don't notice the issue, they just hit the back button repeatedly and that clears the whole messed up stack out, then they forget about it
Mark M.
By keeping this mostly as an "Eclipse" issue by title and category, it's going to be routed to a smaller team inside Google.
Mark
will-do
Mark
thanks!
Mark M.
Yes, it's not a show-stopper for users, which is why I wouldn't design an app to try to avoid it, but it would be nice to have the recipe to fix it, if there is such a recipe.
Mark
agreed, that's why I was toying with the singleTask flag
Mark
but that flag doesn't retain your history stack for some reason
Mark
when you resume your app, it always clears back to the root activity
Mark
oh well
Mark M.
Frankly, I try to avoid messing with those flags to the extent possible.
Mark
haha yeah, Dianne Hackbod seemed to agree with that
Mark
does anyone else have a question, I have 2 more, but don't want to block out others
Dec 8
2:25 PM
Mark M.
@Mark: I think you can go ahead
Mark
ok, so my app has to let users take a picture with the camera - I read your chapter on the camera preview, works great. Just wondering, all I want to do is let users snap a photo, then get that image back to my app
Mark
is it worth implementing all that myself, or better to use the camera intent?
Mark
one down side with the camera intent:
Scott Q.
has left the room
Mark
looks like it has two 'buttons' after the user snaps a photo: "attach" or "cancel"
Mark
if I can't modify those through the intent, it might not be usable
Mark M.
I haven't used the camera Intent. From the discussions I've seen of people who use it, I get the sense I'd be enough of a "type A" personality that I'll want the more direct control over the user experience.
Mark M.
As you can see, for simple stuff, it's not that much code.
Mark M.
Note, though, there is a bug in my book implementation.
Mark M.
I call stopPreview() before calling takePicture() on the Camera.
Mark M.
That's not necessary and actually crashes the DROID (due to a bug in the DROID itself).
Mark M.
You do need to call startPreview() once the picture is taken, though -- the preview automatically stops but does not automatically restart, apparently.
Dec 8
2:30 PM
Mark
hmm interesting - yeah I will have to test that out on the droid then, thanks for the heads up
Mark
On the Market chapter
Mark
when we release an app, versionNumber = 1 for example
Mark
if we upload a new version of our app, we increment the version #
Dec 8
2:35 PM
Mark
how will the phone deal with install of the new version - will it erase data we've written to our own sandbox?
Mark M.
If by "our own sandbox" you mean local databases or files from getFilesDir() and the like, those will be left intact.
Mark M.
If you use SQLiteOpenHelper, and your schema version # changes, then your onUpgrade() method will be invoked to let you upgrade your schema.
Mark M.
The only time local files/databases/shared prefs are removed is if the user uninstalls the app.
Mark
great, makes sense
Dec 8
2:40 PM
Mark M.
@Mark: rolling back to your first question, if you open a new ticket, shoot me the URL so I can star it. With luck, I'll cobble together the time to run some experiments of my own and see if I can noodle out a workaround.
Mark
yeah will-do, I'm thinking they're just going to say "this is expected behavior" and close it!
Dec 8
2:45 PM
Mark
I don't know how the task system works internally - eclipse/marketplace/browser - they all launch the app with that NEW_TASK flag
Mark M.
Eh, doubt it on that issue.
Mark
so *technically* i guess it is, making a new task?
Mark M.
Off the cuff, I suspect it's a case of somebody thinking it was a good idea at the time, a long time ago, and nobody having really raised the issue since.
Mark M.
That doesn't mean it'll necessarily get fixed quickly, and it may be there is some backwards-compatibility reason they will never truly fix it.
Mark M.
But "this is expected behavior" seems unlikely to me.
Mark M.
Does anyone have any other questions?
Dec 8
2:50 PM
Mark
opening the issue now, it'll probably take more than 10 minutes to write it up with examples and all, should I send email to whatever contact info is on the commonsware site?
Mark
(for the url so you can star the issue)
Mark M.
Mark
ok cool I'll send it out in a bit, thanks
Mark M.
Well, lacking other questions, I will close down this office hours session. I may not be able to squeeze in any hours next week, but I should have some in the latter half of December.
Dec 8
2:55 PM
Alexadru B.
sounds good
Alexadru B.
bye
Mark
cool, thanks Mark, great book too
Alexadru B.
has left the room
Mark M.
Thanks!
Mark
has left the room
Mark M.
turned off guest access

← Tuesday, December 1

 

Office Hours

People in this transcript

  • Alexadru Boruz
  • Mark
  • Mark Murphy
  • Scott Quinney