Apr 28 | 9:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Apr 28 | 10:05 AM |
Jeff D. | has entered the room |
Mark M. |
hello, Jeff!
|
Mark M. |
how can I help you today?
|
Jeff D. |
Hi Mark.
|
Jeff D. |
Due to the vagaries of the Android camera, I decided to added one time camera check/setup screens to my app for the camera preview and photo storage. It's a simple preview screen with a rotation button and a Next button. When the user hits Next button, I display a Progress Dialog explaining that the app is saving the picture. Once the Save is done, I present the stored image rotation check/setup. All this works fine except for KitKat.
|
Apr 28 | 10:10 AM |
Jeff D. |
In KitKat, the ProgressDialog displays but the onPictureTaken() callback, which is executed after the ProgressDialog, is not executed. So is there a best practice for presenting the progressdialog that might avoid the problem?
|
Mark M. |
OK, I'm lost already
|
Mark M. |
if it is executed, how can it not be executed?
|
Jeff D. |
OK. let me try again
|
Jeff D. |
I have a button listener. OnClick() has the following steps:
|
Jeff D. |
A. present ProgressDialog
|
Jeff D. |
B. Create a class that implements PictureCallBack
|
Jeff D. |
C. call the camera.takePicture
|
Jeff D. |
Pre-KitKat, this all works fine
|
Apr 28 | 10:15 AM |
Jeff D. |
In KitKat, step C is executed. BUT the onPictureTaken() callback is not executed (based on logs and phone display)
|
Jeff D. |
does that clear up the sequence at least?
|
Mark M. |
yes
|
Mark M. |
what evidence do you have that this has anything to do with the ProgressDialog?
|
Mark M. |
have you removed the ProgressDialog, left everything else intact, and it works reliably?
|
Jeff D. |
when I comment out the ProgressDialog, onPictureTaken() is called and the app works as desired
|
Jeff D. |
yes to your question
|
Mark M. |
that's certainly strange
|
Jeff D. |
In the logs, I see that the preview's surfaceChanged() method is called in KitKat
|
Jeff D. |
but not in other versions
|
Mark M. |
is the app totally frozen in KitKat? IOW, is the main application thread being blocked?
|
Jeff D. |
the ProgressDialog wheel is spinning
|
Mark M. |
hmmmm
|
Jeff D. |
I have tried AsyncTask and Runnable to solve the problem but neither worked
|
Mark M. |
how are you showing the ProgressDialog? via a DialogFragment?
|
Jeff D. |
View paste
|
Mark M. |
I think that will have problems in general
|
Mark M. |
for example, that won't survive a configuration change
|
Apr 28 | 10:20 AM |
Jeff D. |
what do you suggest?
|
Mark M. |
well, I avoid ProgressDialog like the plague
|
Mark M. |
I'd use some other progress indicator
|
Jeff D. |
such as?
|
Mark M. |
ProgressBar, AnimationDrawable on your button, etc.
|
Mark M. |
if you really want a ProgressDialog, try showing it with a DialogFragment and see if that helps
|
Mark M. |
that'll at least improve your support for configuration changes
|
Mark M. |
and it's possible that it will clear up this particular problem
|
Mark M. |
I have not run into a scenario where takePicture() fails with nothing mentioned in logs
|
Jeff D. |
I can swap to ProgressBar
|
Jeff D. |
I'm now just intellectually curious. why is progressDialog to be avoided?
|
Mark M. |
general philosophy in mobile UX design to avoid blocking dialogs in general, wherever possible
|
Jeff D. |
Thanks - I'll try ProgressBar
|
Apr 28 | 10:25 AM |
Jeff D. |
That raises another question. Is there anything like StackOverflow but for design? For example, post a question like "Should I use blocking dialogs?" One designer gave me some tips and I realized how poor my design esthetic is.
|
Mark M. | |
Mark M. |
with regards to modal dialogs (though not strictly for mobile): http://ux.stackexchange.com/questions/12637/wha...
|
Jeff D. |
Thanks - and thanks for the help. Have a great day.
|
Mark M. |
you too!
|
Jeff D. |
btw, I enjoyed your talk at StackExchange
|
Mark M. |
ah! glad you liked it!
|
Jeff D. |
I just skimmed the modal dialog post - WOW
|
Mark M. |
and, if you want a more Android-y perspective on the matter, here's Reto Meier's rant on the topic: http://blog.radioactiveyak.com/2010/08/what-you...
|
Apr 28 | 10:30 AM |
Mark M. |
it's a bit old (2010 -- where have the years gone?)
|
Apr 28 | 10:40 AM |
Jeff D. | has left the room |
Apr 28 | 10:45 AM |
Ron | has entered the room |
Mark M. |
hello, Ron!
|
Mark M. |
how can I help you today?
|
Ron |
Hi Mark, hope I'm not too late.
|
Mark M. |
~12 minutes left
|
Mark M. |
what's on your mind?
|
Ron |
View paste
|
Apr 28 | 10:50 AM |
Mark M. |
no, because one button cannot serve two roles
|
Mark M. |
either it adds a line feed, or it is "done"
|
Mark M. |
you'd need two action buttons
|
Mark M. |
and that's not guaranteed to be supported, and probably usually isn't
|
Mark M. |
exception would be in landscape mode, where "done" or "next" would appear to the right of the text entry area, above the keyboard
|
Ron |
OK, I guess I'll look into wrapping into the 2nd line, right now the "Done" version has the user edittext just going off the screen.
|
Mark M. |
that's a question of constraining your EditText width
|
Mark M. |
combination of layout rules and android:maxWidth
|
Apr 28 | 10:55 AM |
Ron |
The width is constrained, I meant to say extra text disappears rather than seeing it on the next line. Thanks, I know what I need to focus on now.
|
Apr 28 | 11:00 AM |
Mark M. |
that's a wrap for today's chat
|
Mark M. |
the transcript will be archived at http://commonsware.com/office-hours/ shortly
|
Mark M. |
the next chat is next Monday at 4pm US Eastern Daylight Time
|
Mark M. |
have a pleasant day!
|
Ron | has left the room |
Mark M. | turned off guest access |