Office Hours — Today, April 23

Wednesday, April 21

Apr 23
9:25 AM
Mark M.
has entered the room
Mark M.
turned on guest access
9:30 AM
Mike R.
has entered the room
Mark M.
howdy, Mike!
Mike R.
Hi Mark
My company has decided to wait until I've forgotten everything I learned about Android to start an Android project.
So I imagine you
will be hearing from me
Mark M.
ha!
Mike R.
Ok, first question.
Mark M.
that's OK, developing for Android is like riding a bike
you fall down and skin your knee a lot
:-)
Mike R.
My app is going to have a lot of threads that go out to the internet, parse some downloaded xml and update a SQLLite database
On iPhone, SQLLite is not very thread friendly and I image it is not on Android either.
Mark M.
it's not bad
Mike R.
SQLLite generates lock failures if two threads try to open the database at the same time.
9:35 AM
Mark M.
correct
Mike R.
On the iPhone my architecture is this: I have a single thread that handles all database operations. All my other threads call methods on the database thread and wait until the method calls are completed.
So, how to do this in Android? Is this a case for have a local service?
Mark M.
well, at the core, you use Java synchronization
java.util.concurrent is best
synchronized keyword is OK
I'm personally not a fan of the "dedicated DB thread" pattern
just synchronize access to the DB on the threads you are using for other reasons
Mike R.
ok thanks. i'll take a look at trying that approach
9:40 AM
Mark F.
has entered the room
Mark M.
Howdy, Mark!
Mark F.
Good morning
Mark M.
anybody have a question?
Mark F.
I was just planning on listening in ...
I'm just starting out on my fist app for Android
Mark M.
OK
9:45 AM
Mark F.
I've been playing with the animations, etc
scaling, translations
Mike R.
has left the room
Mark M.
yup
Mark F.
As I've noticed in a few of you forum posts - the setFillAfter() method causes some confusion
Mark M.
heh, yeah
Mark F.
The "app" I'm developing is going to be a coach's playboard...with x's and o's etc
nothing too ambitious for starting out
Mark M.
OK
9:50 AM
Mark F.
Currently, my background is an ImageView and the X's and O's etc are bitmaps
I'm thinking I may have some problems getting them to scale and translate with the background
in sync with the background...
Mark M.
off the cuff, this feels like a better thing to do with 2D graphics and the Canvas
when I think "coach's playboard", I think challk
er, chalk
drawings
Rick
has entered the room
Mark M.
not individual widgets representing players
Mark F.
We'll I'm using a Canvas for drawing the bitmap images. It seemed the easiest for placement of the items
Mark M.
:: shrug ::
Easy, tactically, perhaps
Mark F.
I'm allowing the user to "grab" and X or O and drag it to a new location.
Mark M.
OK
that still sounds like a 2D game to me
Mark F.
I think you're right about the game thing...
Mark M.
I just think you're going to find yourself perpetually painted (pun lightly intended) in a corner by basing it on widgets
versus doing the whole thing as drawing on the Canvas
9:55 AM
Mark M.
now, bear in mind I haven't done 2D graphics in Android, so my expertise there is limited at beset
er, best
BTW: howdy, Rick!
Rick
hi
Mark F.
Like I said - I'm just starting out....so I've tried a few approaches and gotten about 70% there
Mark M.
that's pretty good for just starting out
Mark F.
It seemed easiest to use a widget for the background so I could easily transform for zooming and scrolling
Mark M.
as for me, there are hamsters with more aesthetic sense than I possess, so I'm in no hurry to get into 2D/3D graphics... :-)
Mark F.
well my background is medical and financial apps, so I'm not much into graphics either!
Mark M.
on the plus side, you can extend your coach's playboard into a comprehensive injured reserve and salary cap management app
just in time for the NFL draft, if you hurry
:-)
Rick
too late
Mark F.
good idea!
Mark M.
there's still six more rounds to go -- plenty of time!
Rick
:)
Mark F.
I'm from Canada, so I've got a few weeks before the NHL draft!
Rick
I have a simple question (I think)
Mark M.
Rick: go ahead
Rick
I have to admit I have spend zero time researchiing it
10:00 AM
Rick
but noticed the office hours were on
Are the AVD's part of the Android open source ?
Mark M.
Um
I assume you mean the data that goes in the images?
or do you mean the emulator itself?
Rick
both
Mark M.
well, the emulator is mostly qemu
AFAIK, the images can be built from the AOSP
that's how some custom firmware work gets done
but, I'm not a firmware guy, so I haven't built my own images, let alone recently
Rick
when you say "mostly" qemu, are there other pieces somewhere?
Mark M.
I am just guessing that, since qemu was targeted at PC-style machines, there might be additional stuff for emulating an ARM-based smartphone
Rick
Maybe I should tell you what we want to do
We want to build our own Android system on a custom board
and want to interface with it remotely using a similar interface as the AVD's
ChuckH
has entered the room
Mark M.
I don't follow the "interface with it" part
10:05 AM
Mark M.
are you looking for the emulator to effectively draw to a VNC-style remote access thing?
10:05 AM
Rick
The android system won't have a keyboard/touchscreen
So I want the remote workstation to "be" the keyboard/touchscreen interface
Mark M.
to me, that sounds like a firmware mod to add VNC-style access
echo the framebuffer to the remote viewer
translate remote viewer commands to touchscreen and key events
you might learn some stuff from how the emulator bridges to qemu for that sort of thing
however, this is all waaaaaaaaaaaaaaaay outside my area of expertise
Rick
Mine too
I was thinking we would interface at the device driver level
Mark M.
that's possible
Rick
and hoped that I could see where that happens in the AVD code
and keep everything above that level
Mark M.
yeah, well, I'm not going to be a lot of help there, unfortunately
Rick
OK, thanks anyway
Mark M.
sounds like a good question for the [android-porting] Google Group
Rick
OK
Mark M.
BTW: howdy, ChuckH!
10:10 AM
ChuckH
Hi Mark, I had stepped out and just got back in. Howdy!
I'm a beginner and starting to enjoy your books and offerings, much thanks.
Mark M.
you're very welcome!
anybody have a question?
ChuckH
I didn't think I had any question and wanted to just learn how this chat went. I'm glad I came because now I do have questions. like can or should a service handle sending say a text message via phone number or should it wake up an activity to do it?
Mark M.
uh, that's difficult to answer in the abstract
10:15 AM
Mark M.
AFAIK, a service can use SmsManager
and, a service should almost never "wake up an activity"
because that might interrupt the user
who might get angry
and punch somebody
and we don't like having that on our conscience
but, if you're expecting the user to type in the text message to be sent, you're going to have to do something
usually, in that case, though, the user has initiated something in your app that is triggering the need for an SMS (e.g., clicked a menu choice)
ChuckH
I'm thinking about a service that will periodically check for a GPS location that then sending that info to another phone or person via email or some other method. I'm making this my homework assignment.
Mark M.
hrm
your service could do all of that
though getting a GPS fix out of sleep mode gets a bit tricky
ChuckH
Good point. Any ideas?
Maybe for now, it'll have to do it when it's awake.
Mark M.
Ummmm...choose an easier homework assignment? :-)
ChuckH
Yeah, I'll have to redefine the project a bit.
Mark M.
what you'll have to do is use AlarmManager to schedule waking up the service
however, you'll want to use a regular Service, not an IntentService (let alone my WakefulIntentService)
10:20 AM
Mark M.
have the Service register for location updates
When a location update comes in, do the SMS thing
and then stopSelf() so the service goes away
and, use a WakeLock to keep the device awake during all of htat
er, that
oh, and unregister for location updates and release the WakeLock before stopSelf()
getting all of that wired together is...unpleasant
ChuckH
Wow, great. So there is a way! Oops, ... why unpleasant?
Mark M.
just a lot of tricky little bits
screw up, and you will leak memory, or leave the CPU running indefinitely
this specific pattern is one I probably need to work up a canonical example for, since this comes up a lot, and my WakefulIntentService is not suitable for this scenario
ChuckH
Thanks Mark. Say, is there a way to log this transcript or do I have to copy everything?
rscottmoyer
has entered the room
Scott M.
has entered the room
Mark M.
I post links to transcripts out on the [cw-android] Google Group after each chat ends
howdy, Scott and his twin brother Scott!
Scott M.
Hi
10:25 AM
Mark M.
(leastways, I see you twice in the "Who's Here" list)
Scott M.
Sorry, browser problems
ChuckH
For my homework, I'll try to reduce the project scope. Thank you Mark M.
Mark M.
chat's almost over -- Scott, did you have a question?
Scott M.
Mark, can you point me to any better documentation of the dx tool (better than --help)?
Mark M.
nope
I've looked myself a fair bit
source code is probably your best bet, if you can grok it
Scott M.
Can you tell me what the --keep-classes option does?
Mark M.
nope
I've only fussed with dx for some very specific things
Mark F.
has left the room
ChuckH
Thanks Mark! Bye.
ChuckH
has left the room
Scott M.
I'm working on the ruboto-irb (JRuby) project. I'm looking for a way of getting ruby's require to recognize classes in a classes.dex. My quest continues...
Mark M.
I thought your name sounded familiar... :-)
Look at DexFile and DexClassLoader, if you haven't already
Scott M.
I guess I'll read the code :-0
10:30 AM
Mark M.
not sure if they'll help your scenario, but they're easier to work with than trying to make sense of the .dex file itself
Scott M.
I looked, but I didn't touch
Mark M.
DexClassLoader offers findClass(), getPackage(), etc.
works on a JAR with classes.dex
Scott M.
Thanks!
No, works with jar before dex'ed
Mark M.
I keep lightly tuned into the ruboto Google Group
you want to use a JAR without dexing? I doubt that's possible
Scott M.
Android (Java) side can load dex'ed of course
Mark M.
Android doesn't have on-device dexing, AFAIK
Scott M.
No, I just meant outside of Android...I was just hoping ot get the same thing after dex
Mark M.
oh, sorry, I was back on thinking about trying to get a require statement to work
10:35 AM
Mark M.
anyway, as I was saying, if you have an Android question that gets posted to the ruboto group that doesn't get answered, feel free to tap me on the virtual shoulder
and with that, today's office hour is pretty much done
Scott M.
Thanks. I'll let you go now. We past 10:30.
Mark M.
another couple of chats next week
have a pleasant day and weekend, everyone!
Rick
has left the room
rscottmoyer
has left the room
Scott M.
has left the room
Mark M.
turned off guest access

Wednesday, April 21

 

Office Hours

People in this transcript

  • ChuckH
  • Mark Faulkner
  • Mark Murphy
  • Mike Renda
  • Rick
  • rscottmoyer
  • Scott Moyer