Office Hours — Today, February 23

Saturday, February 20

Feb 23
7:20 PM
Mark M.
has entered the room
Mark M.
turned on guest access
7:25 PM
Steve
has entered the room
Mark M.
hello, Steve!
Steve
Hi, Mark!
Mark M.
how can I help you today?
Steve
I have a question about animated Gifs. Here it is:
View paste
I want to include animation in an app using an animated GIF or an equivalent. Your book says that "Android, on the whole, does not support animated GIF files," and you describe an approach using an AnimationDrawable. I'm open to taking that approach.

I have, however, seen some alternative approaches that claim you can use animated Gifs directly in an Android app. They seem to involve using android.graphics.Move with the possible addition of a WebView. These approaches appear simpler than using an AnimationDrawable. Are they reasonable or should I prefer AnimationDrawable?
Mark M.
whew
I thought your question was "can you hit the monkey?"
Steve
no, that's for a different site
sorry, it should be: android.graphics.Movie
Mark M.
there are libraries now on the Android Arsenal that offer some amount of animated GIF
er, animated GIF support
I haven't used any of them
WebView is very heavyweight, and IIRC Movie was as well
Steve
ok. so that would be reasons one might avoid the approach i mentioned.
Mark M.
AnimationDrawable is not that tough, once you convert over your GIF, though it result in a 'splosion of resources
so, for that reason, you might poke around at those libraries
7:30 PM
Mark M.
I'll need to play around with them myself and update that portion of the book sometime
Scott W.
has entered the room
Steve
thanks, Mark. i'll take a look at the Android Arsenal libraries. but it sounds like using AnimationDrawable would provide a robust implementation.
Mark M.
OK
Scott W.
Hello!
Mark M.
Steve: let me take a question from Scott, and I'll be back with you shortly
Scott: hi! how can I help you today?
Steve
thanks, Mark.
Scott W.
I'm having a device specific problem with camera flash modes.
Mark M.
aren't we all? :-)
Scott W.
I have an app that has a live preview with a toggle button for the torch light
This toggle works by setting flash mode to FLASH_MODE_TORCH when I want it on, and then back to FLASH_MODE_AUTO when I want it off.
Mark M.
OK, so you're using the classic camera API
Scott W.
right
I'm actually going through your camera2 chapter to see if that fixes the problem right now
but that's a whole lot of work to get a torch feature working
so anyway...
the torch toggle works on Samsung devices, HTC devices, but not Nexus devices
the only way to get it to work on Nexus phones is to set flash mode to OFF first, wait a bit, then set it to AUTO
7:35 PM
Mark M.
is there any particular problem in using that approach for all devices?
Scott W.
100ms wait works, but if I made the call one after another (still committing the parameter changes), it won't work.
I'm nervous about introducing a Runnable anywhere due to asynchronous nature of our app.
Mark M.
is there any particular problem in using that approach for all devices?
:: shrug ::
camera hardware is flaky
I mean, developers have problems with it on all days that end in "y"
Scott W.
aight fair enough
Mark M.
I'm not completely shocked that rapid-fire flash mode changes cause problems
if your concern is literally the Runnable, fork a thread that does Thread.sleep(100) and then changes the parameters
Scott W.
will do.
Mark M.
you could say "only do that on Nexus devices", though there may be others with similar flash issues
Scott W.
how can I pick out just Nexus devices?
Mark M.
Build.MANUFACTURER and Build.PRODUCT, compared against a table of devices that are giving you grief
7:40 PM
Scott W.
I will do this
Mark M.
you might consider having "flash compatibility mode" or some such tucked away in Settings to override default behavior as well, in case users in the field run into this for non-Nexus devices
Scott W.
good idea.
Mark M.
after one failed and one not-yet-failed camera library, I have a fair amount of MANUFACTURER/PRODUCT workarounds under my belt...
Scott W.
have you been using camera2 a lot?
Mark M.
enough to write CWAC-Cam2
(the not-yet-failed library)
in the modern world, we sometimes refer to complex things as "byzantine"
the Byzantines would refer to complex things as "like the Android camera2 API"
Scott W.
why's that?
Mark M.
why has it not yet failed? give it time! :-)
Scott W.
no why byzantine?
Mark M.
I actually pretty much grokked the original API
Camera2... I understand barely enough to write the sections on it in the book chapter
and there's *lots* of hand-waving in that chapter
Scott W.
yeah... I used the Android sample a lot in conjunction with your chapter.
Mark M.
let me take another question from Steve, and I'll be back with you in a bit
Scott W.
ok cool
Mark M.
Steve: your turn! do you have another question?
7:45 PM
Steve
Just one quick question. I took a quick look at the Arsenal, and will probably just follow your chapter.
Is there any kind of vetting process for the libraries in Android Arsenal?
Mark M.
somebody had to write a pull request and submit it to the GitHub repo that forms the backbone of the Arsenal
Scott W.
I asked this same question to my manager today :D
Mark M.
otherwise, no
Steve
ok. thanks so much for your help, Mark!
Mark M.
I am not aware of any site that offers library reviews and the liek
er, like
Steve
have a good night!
Mark M.
you too!
Steve
has left the room
Mark M.
Scott: back to you! do you have another question?
Scott W.
yeah
this is venturing into un-researched territory though. Feel free to just point me in the right direction.
I inherited a bunch of code, and one part of the video capturing that I haven't gotten around to is SurfaceTextures
we have this random surface texture mSurfaceTexture = new SurfaceTexture(42);
I don't know what the surface texture is really, or why there's a 42 in there.
Mark M.
well, clearly, that's how many roads a man must walk down
:-)
7:50 PM
Scott W.
It's fun sometimes
Mark M.
while I have used SurfaceTexture, I have gotten it from other stuff, as I recall
I don't think that I have ever created one, looking at the JavaDocs for the constructor
because I haven't the foggiest notion what "the OpenGL texture object name" means
OpenGL is one of many specialized areas in Android that I haven't ventured, nor really plan to
Scott W.
I see
that's 90% of our app
very difficult to work on as a beginner developer
Mark M.
I can imagine
Scott W.
well I don't want to hold you up. I would just be grasping at questions at this point.
Mark M.
no worries
sorry I couldn't be of greater use on that one
Scott W.
I bought your book the day I got this job and it has helped me out a ton.
thank you very much!
Mark M.
you are very welcome!
Scott W.
Oh wait!
quick question
I skimmed through the Android for desktop chapter today
and it seems like an odd chapter to be in the book. Like speculation. Why did you put it in?
Mark M.
hah!
yeah, it's rather unusual that way
I was writing some notes down and decided I may as well roll it into a chapter
7:55 PM
Mark M.
it'll get slowly expanded over the next update or two
and, if predictions come true, it'll get substantially updated after Google I|O
Scott W.
You think Google will pick a direction soon?
ok awesome
Mark M.
I'
er
I'd phrase it more as "Google will emphasize a direction. Or two."
Scott W.
that's exciting
it'll keep us from writing a Windows app hopefully
Mark M.
that'll depend on Google's choices
if the emphasis is on new hardware, then you'll be dealing with Windows for quite a while
Scott W.
:(
Mark M.
if, however, they elect to beef up/overhaul the ARC stuff for Chrome, or they come up with their own Android-on-Windows play, then things get interesting
Scott W.
fingers crossed
Mark M.
or, it could all just be rumors, and they'll do something totally different, like Android for Kitchens
Scott W.
OK I'm going to implement this Nexus workaround.
I read that as Android for Kittens at first
8:00 PM
Scott W.
got preeeetty pumped
Mark M.
I suppose that's another possibility
Scott W.
I plan on taking advantage of these chats in the future, so maybe I'll talk to you later.
Thanks again for all the help.
Mark M.
you're welcome!
Scott W.
bye bye
Scott W.
has left the room
8:25 PM
Mark M.
turned off guest access

Saturday, February 20

 

Office Hours

People in this transcript

  • Mark Murphy
  • Scott Wehby
  • Steve