Apr 23 | 9:25 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Apr 23 | 9:30 AM |
Mike R. | has entered the room |
Mark M. |
howdy, Mike!
|
Mike R. |
Hi Mark
|
Mike R. |
My company has decided to wait until I've forgotten everything I learned about Android to start an Android project.
|
Mike R. |
So I imagine you
|
Mike R. |
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
|
Mark M. |
you fall down and skin your knee a lot
|
Mark M. |
:-)
|
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
|
Mike R. |
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.
|
Apr 23 | 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.
|
Mike R. |
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
|
Mark M. |
java.util.concurrent is best
|
Mark M. |
synchronized keyword is OK
|
Mark M. |
I'm personally not a fan of the "dedicated DB thread" pattern
|
Mark M. |
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
|
Apr 23 | 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 ...
|
Mark F. |
I'm just starting out on my fist app for Android
|
Mark M. |
OK
|
Apr 23 | 9:45 AM |
Mark F. |
I've been playing with the animations, etc
|
Mark F. |
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
|
Mark F. |
nothing too ambitious for starting out
|
Mark M. |
OK
|
Apr 23 | 9:50 AM |
Mark F. |
Currently, my background is an ImageView and the X's and O's etc are bitmaps
|
Mark F. |
I'm thinking I may have some problems getting them to scale and translate with the background
|
Mark F. |
in sync with the background...
|
Mark M. |
off the cuff, this feels like a better thing to do with 2D graphics and the Canvas
|
Mark M. |
when I think "coach's playboard", I think challk
|
Mark M. |
er, chalk
|
Mark M. |
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 ::
|
Mark M. |
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
|
Mark M. |
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
|
Mark M. |
versus doing the whole thing as drawing on the Canvas
|
Apr 23 | 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
|
Mark M. |
er, best
|
Mark M. |
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
|
Mark M. |
just in time for the NFL draft, if you hurry
|
Mark M. |
:-)
|
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
|
Apr 23 | 10:00 AM |
Rick |
but noticed the office hours were on
|
Rick |
Are the AVD's part of the Android open source ?
|
Mark M. |
Um
|
Mark M. |
I assume you mean the data that goes in the images?
|
Mark M. |
or do you mean the emulator itself?
|
Rick |
both
|
Mark M. |
well, the emulator is mostly qemu
|
Mark M. |
AFAIK, the images can be built from the AOSP
|
Mark M. |
that's how some custom firmware work gets done
|
Mark M. |
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
|
Rick |
We want to build our own Android system on a custom board
|
Rick |
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
|
Apr 23 | 10:05 AM |
Mark M. |
are you looking for the emulator to effectively draw to a VNC-style remote access thing?
|
Apr 23 | 10:05 AM |
Rick |
The android system won't have a keyboard/touchscreen
|
Rick |
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
|
Mark M. |
echo the framebuffer to the remote viewer
|
Mark M. |
translate remote viewer commands to touchscreen and key events
|
Mark M. |
you might learn some stuff from how the emulator bridges to qemu for that sort of thing
|
Mark M. |
however, this is all waaaaaaaaaaaaaaaay outside my area of expertise
|
Rick |
Mine too
|
Rick |
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
|
Rick |
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!
|
Apr 23 | 10:10 AM |
ChuckH |
Hi Mark, I had stepped out and just got back in. Howdy!
|
ChuckH |
I'm a beginner and starting to enjoy your books and offerings, much thanks.
|
Mark M. |
you're very welcome!
|
Mark M. |
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
|
Apr 23 | 10:15 AM |
Mark M. |
AFAIK, a service can use SmsManager
|
Mark M. |
and, a service should almost never "wake up an activity"
|
Mark M. |
because that might interrupt the user
|
Mark M. |
who might get angry
|
Mark M. |
and punch somebody
|
Mark M. |
and we don't like having that on our conscience
|
Mark M. |
but, if you're expecting the user to type in the text message to be sent, you're going to have to do something
|
Mark M. |
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
|
Mark M. |
your service could do all of that
|
Mark M. |
though getting a GPS fix out of sleep mode gets a bit tricky
|
ChuckH |
Good point. Any ideas?
|
ChuckH |
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
|
Mark M. |
however, you'll want to use a regular Service, not an IntentService (let alone my WakefulIntentService)
|
Apr 23 | 10:20 AM |
Mark M. |
have the Service register for location updates
|
Mark M. |
When a location update comes in, do the SMS thing
|
Mark M. |
and then stopSelf() so the service goes away
|
Mark M. |
and, use a WakeLock to keep the device awake during all of htat
|
Mark M. |
er, that
|
Mark M. |
oh, and unregister for location updates and release the WakeLock before stopSelf()
|
Mark M. |
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
|
Mark M. |
screw up, and you will leak memory, or leave the CPU running indefinitely
|
Mark M. |
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
|
Mark M. |
howdy, Scott and his twin brother Scott!
|
Scott M. |
Hi
|
Apr 23 | 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
|
Mark M. |
I've looked myself a fair bit
|
Mark M. |
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
|
Mark M. |
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... :-)
|
Mark M. |
Look at DexFile and DexClassLoader, if you haven't already
|
Scott M. |
I guess I'll read the code :-0
|
Apr 23 | 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.
|
Mark M. |
works on a JAR with classes.dex
|
Scott M. |
Thanks!
|
Scott M. |
No, works with jar before dex'ed
|
Mark M. |
I keep lightly tuned into the ruboto Google Group
|
Mark M. |
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
|
Apr 23 | 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
|
Mark M. |
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
|
Mark M. |
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 |