Mark M. | has entered the room |
Mark M. | turned on guest access |
Jul 6 | 8:00 PM |
Bonnie | has entered the room |
Bonnie |
Hi :)
|
Mark M. |
howdy, Bonnie!
|
Bonnie |
How are you doing?
|
Mark M. |
under the weather
|
Mark M. |
otherwise, OK -- and you?
|
Bonnie |
Oh, that's too bad
|
Bonnie |
I'm ok
|
Bonnie |
I'm going to upload a screenshot because I have a
question.
|
Bonnie | |
Mark M. |
you're wondering why the EditTexts get short
|
Mark M. |
right?
|
Bonnie |
I copied the XML layout file word for word.
|
Bonnie |
Yeah
|
Mark M. |
bug in Android
|
Bonnie |
Oh, ok
|
Mark M. |
I have an outstanding issue on it in b.android.com
|
Bonnie |
Ok I just had to make sure
|
Mark M. |
I don't remember seeing it in 2.2, so perhaps it
is fixed now
|
Bonnie |
Ok
|
Bonnie |
Also, near the end of the layout file, I wonder if
there is a typo.
|
Bonnie |
I see this: android:layout_above="@id/details"
|
Bonnie |
And there is no + after the @
|
Bonnie |
Is that a typo or does it mean something
different?
|
Mark M. |
because @+id/details appears earlier in the file,
IIRC
|
Jul 6 | 8:05 PM |
Bonnie |
Usually it's @+id
|
Jul 6 | 8:05 PM |
Mark M. |
you only need the + if it is the first time you
use the ID
|
Bonnie |
Ok
|
Bonnie |
I see. Thanks :)
|
Mark M. |
second and subsequent times, you can drop it
|
Bonnie |
Ok
|
Mark M. |
any other questions?
|
Bonnie |
One more thing
|
Bonnie |
I'm on page 41 of the Busy Coder's book
|
Bonnie |
It describes a new and easier way of linking
OnClick to a button
|
Bonnie |
instead of using the anonymous inner class
|
Mark M. |
android:onClick="..."
|
Bonnie |
Yeah
|
Bonnie |
I was wondering if you had a full code sample for
the entire application for that.
|
Bonnie |
I have two code fragments, but I'm a beginner.
|
Mark M. |
not in that book
|
Bonnie |
It helps if I get the whole thing.
|
Mark M. |
however...
|
Mark M. | |
Mark M. |
That is a short example from my Advanced Android
book that uses this technique
|
Jul 6 | 8:10 PM |
Mark M. |
Just kinda ignore everything else in the sample
:-)
|
Bonnie |
Ok, perfect
|
Bonnie |
Ok :)
|
Bonnie |
I looked at the main.xml file and can't find the
android:onClick="..." part. Is it in another file?
|
Mark M. |
hold on
|
Jul 6 | 8:15 PM |
Mark M. |
whoops, sorry, wrong example
|
Bonnie |
ok
|
Mark M. | |
Bonnie |
Thanks, I see it now
|
Bonnie |
Back to my first question. Everytime there is a
bug in Android, how do you work around it, or are you just forced to
avoid using that layout until a new version is released?
|
Bonnie |
for bugs in general, I mean
|
Mark M. |
that's impossible to answer in the abstract
|
Bonnie |
Yeah, I guess it is pretty broad
|
Mark M. |
in the case of having a TableLayout and ListView
as siblings in the same parent, you'd just have to come up with a
different UI
|
Bonnie |
ok
|
Mark M. |
for example, this problem goes away in a tutorial
or two, when you split those into separate tabs
|
Bonnie |
I see
|
Jere_Jones | has entered the room |
Mark M. |
howdy, Jere_Jones!
|
Jere_Jones |
Howdy!
|
Bonnie |
Hi :)
|
Jul 6 | 8:20 PM |
Jere_Jones |
Friendly room today! :) Hi Bonnie!
|
Mark M. |
what can I do for you this evening?
|
Jere_Jones |
My original intent was to lurk but I'm glad to
grill you if no one else is.
|
Bonnie |
I'm done with asking my questions for now
|
Mark M. |
small crowd on the day after a holiday, I suppose
|
Mark M. |
hence, grill away
|
Mark M. |
though if you break out a bottle of A-1 Steak
Sauce, I'm outta here
|
Mark M. |
:-)
|
Jere_Jones |
Cool. What kind of thoughts do you have on
testing? Particularly unit tests and activity simulations.
|
Mark M. |
On Android, it drives me up a wall
|
Jere_Jones |
My specific problem area is how to test without
having to constantly reset the db.
|
Mark M. |
uh, well, JUnit-style testing tends to want you to
start from a clean slate on each test method
|
Jere_Jones |
Extracting that dependency is what I would do in
C#. In Java/Android, eh, I'm less organized I guess.
|
Mark M. |
I think there are ways around that, though I'm
fuzzy on the details
|
Mark M. |
Personally, I'd try to test as much as possible
outside of Anroid
|
Mark M. |
er, Android
|
Mark M. |
whatever business logic you can keep in a separate
JAR and test however you want, the better
|
Mark M. |
that doesn't tend to work out too often in
practice, though
|
Jere_Jones |
I have noticed that testing on the emulator is dog
slow.
|
Mark M. |
it helps if you choose the right test case class
|
Mark M. |
depending on what you're testing
|
Jul 6 | 8:25 PM |
Jere_Jones |
I'm using AndroidTestCase for behind the scenes
stuff and AndroidInstrumentationTestCase2 for ui interaction testing
|
Mark M. |
yup, that's about the right answer
|
Mark M. |
if any "behind the scenes stuff" doesn't interact
with Android much, you may be able to just use TestCase
|
Jere_Jones |
It is the ui stuff that is just SLOW. 5-10
seconds per test.
|
Mark M. |
yup
|
Mark M. |
did I mention that testing on Android drives me up
a wall?
|
Jere_Jones |
I don't have any pure calculation testing to do.
So I'm either dealing with the database or the ui. Ugh.
|
Jere_Jones |
Robotium is really helpful for ui testing, but
still slow.
|
Jere_Jones |
Gotta test though. Irritating or not. I hate
regression bugs.
|
Mark M. |
haven't had a chance to play with Robotium yet
|
Jere_Jones |
Oh! Concrete question!
|
Mark M. |
but if they have Cucumber integration the way
their home page says, I gotta give it a shot
|
Jere_Jones |
I have an AVD that was specified to mimic my EVO.
But sometimes it shows up as HDPI and sometimes as MDPI. I don't get
why it would change? Any idea?
|
Mark M. |
what do you mean by "shows up as HDPI"?
|
Mark M. |
and concrete "is a construction material composed
of cement (commonly Portland cement) and other cementitious materials
such as fly ash and slag cement, aggregate (generally a coarse aggregate
made of gravels or crushed rocks such as limestone, or granite, plus a
fine aggregate such as sand), water, and chemical admixtures"
|
Jere_Jones |
It's like sometimes it thinks it is 480x800.
Other times it thinks it is 320x480.
|
Mark M. | |
Mark M. |
:-)
|
Jere_Jones |
Concrete vs Abstract. :)
|
Mark M. |
that behavior is really strange
|
Mark M. |
that's in an AVD config file
|
Mark M. |
it should not fluctuate
|
Jul 6 | 8:30 PM |
Jere_Jones |
That's what I thought. I get the same behavior
whether Eclipse kicks off the emulator or IntelliJ IDEA.
|
Mark M. |
you might post that one to [android-developers] --
Xav Ducrohet is responding to a reasonable number of tools questions
|
Jere_Jones |
Ok.
|
Bonnie |
Question - where do you learn about testing as a
beginner? I haven't gotten there yet. I'm self-teaching myself without
a Comp Sci. degree.
|
Jere_Jones |
Philosophy? Technique? Syntax?
|
Mark M. |
lots of books, both language-specific and general
|
Bonnie |
Technique to start, I suppose
|
Bonnie |
Ok
|
Mark M. |
for Android, a book on JUnit would be a likely
starting point
|
Bonnie |
Yeah, JUnit sounds familiar.
|
Bonnie |
The other stuff you two discussed was Greek to me.
|
Mark M. |
unfortunately, this is one of those things where
Java's book peak was several years ago
|
Jul 6 | 8:35 PM |
Mark M. |
JUnit Recipes: Practical Methods for Programmer
Testing and Pragmatic Unit Testing in Java with JUnit are solid choices
based on Amazon reviews
|
Jere_Jones |
There are (that I know of) three primary
techniques to testing. AAA, Record and Replay, and Behavior. I'm a big
AAA (Arrange, Act, Assert) guy myself. Just makes more sense. And
JUnit is set up just for that. Cucumber, which Mark mentioned earlier,
is a Behavior type. I don't know of anything that is Record and Replay
in Java.
|
Mark M. |
but they were for 2004, so there will be some
places where they are out of date with respect to where JUnit progressed
|
Bonnie |
Ok
|
Bonnie |
I'll make a note of that, thanks
|
Mark M. |
you can find some record-and-replay tools for
Swing, but it would take firmware mods to do it in Android
|
Jere_Jones |
It is probably still good. JUnit has a fairly
stable syntax.
|
Jere_Jones |
I think AAA is the easiest to get started with.
Would you think so Mark?
|
Mark M. |
when I learned software testing, we were doing it
with flint axes
|
Mark M. |
hence, AAA and Behavior are a wee bit newer than I
tend to think :-)
|
Jere_Jones |
I started as a C++ programmer where unit tests are
fancy dancy things that managed programmers do. :)
|
Mark M. |
a well-done Behavior framework can simplify things
greatly...but an incomplete one would be frustrating as all get out
|
Mark M. |
AAA is probably the most straight-forward approach
|
Mark M. |
and it's what Android is set up to do
|
Mark M. |
if it weren't for that teensy performance issue
|
Jere_Jones |
You would probably have the performance issue
regardless of technique, wouldn't you?
|
Jul 6 | 8:40 PM |
Mark M. |
it certainly won't be fast
|
Mark M. |
but JUnit wants to flush everything and rebuild it
all on each test method
|
Mark M. |
that's what makes the UI testing so slow
|
Mark M. |
so, take the Test Monkey -- it is fairly snappy,
but it is effectively write-only
|
Mark M. |
(other than exceptions the random input raises)
|
Jere_Jones |
Bonnie, my favorite beginner testing book has been
the Art of Unit Testing. The examples are in C# but the syntax is very
close to Java and the ideas are language agnostic.
|
Bonnie |
Ok
|
Jere_Jones |
I still haven't tried Monkey.
|
Mark M. |
it's really easy to run
|
Mark M. |
and always good for a laugh
|
Bonnie |
Just curious, do you both have degrees or are
self-taught?
|
Mark M. |
I have degrees, but not in computer science
|
Jere_Jones |
I'm self taught.
|
Bonnie |
Ok :)
|
Bonnie |
Awesome
|
Bonnie |
How long did it take until you felt confident?
|
Mark M. |
confident in what?
|
Bonnie |
I took one C++ course at a community college after
doing a degree in something else and I'm learning the rest on my own.
|
Bonnie |
In general, as a programmer.
|
Mark M. |
:: shrug ::
|
Bonnie |
on par with someone with a degree.
|
Jere_Jones |
My favorite quote: "Computer Science is as much
about programming as Astronomy is about telescopes"
|
Mark M. |
I learned programming by writing BASIC code on
pieces of paper, bringing it to my local Radio Shack, and entering it on
a TRS-80 Model I they had on display
|
Bonnie |
Haha :)
|
Jere_Jones |
Don't feel inferior to those with degrees.
|
Bonnie |
Ok
|
Mark M. |
yeah, seriously
|
Bonnie |
That's good to know
|
Jul 6 | 8:45 PM |
Mark M. |
there are tons of self-taught developers
|
Jere_Jones |
Very few of the best programmers I know have CS
degrees. They are more likely to have liberal arts degrees.
|
Mark M. |
particularly on newer technologies
|
Jere_Jones |
Or no degrees.
|
Bonnie |
Ok. I guess the job ads are misleading.
|
Bonnie |
They always seem to require degrees, but the ads
are probably written by non-programmers.
|
Mark M. |
ah, well, hiring managers will ask for the sun,
moon, and stars
|
Mark M. |
then, it's a question of how urgent the need is
|
Jere_Jones |
They will (sometimes) also say "or equivalent
experience"
|
Mark M. |
nowadays, I'd focus on building up a portfolio
demonstrating your ability -- blog posts, open source apps,
contributions to open source projects, etc.
|
Jere_Jones |
In my experience it doesn't take much experience
to be equivalent to a CS Bachelors unless the job is math/algorithm
heavy.
|
Bonnie |
True, I see that a lot too
|
Bonnie |
Ah, no wonder. I look at game industry postings a
lot.
|
Mark M. |
whether you got that ability from a CS degree, a
bunch of books, or a Vulcan mind-meld won't matter if they can see the
ability
|
Bonnie |
Haha ok :)
|
Jere_Jones |
Right!
|
Mark M. |
game industry used to be a bit more difficult to
get into, but I haven't paid much attention in the past, oh, 15 years or
so... :-)
|
Bonnie |
I decided to become an indie game developer for
Android
|
Jere_Jones |
IMHO, the best way to improve as a programmer is
to program. Read lots of code. Write lots of code.
|
Bonnie |
Yeah
|
Bonnie |
Mark's tutorial book is helping a lot. My other
Android books have lots of prose but only a few lines of code here and
there.
|
Jul 6 | 8:50 PM |
Mark M. |
yeah, that's why I'm big on fully-runnable sample
projects
|
Mark M. |
and lots of small ones, outside of the Tutorials
|
Bonnie |
It's a fantastic way to learn
|
Jere_Jones |
Mark, relatively simple question: What is the
difference between a Service and an IntentService other than the self
included thread in an IntentService?
|
Mark M. |
IntentService will automatically call stopSelf()
if, after onHandleIntent() completes work on the background thread,
there is no more work to be done (i.e., no startService() calls in the
meantime)
|
Mark M. |
so, IntentService is a great "fire and forget" way
of doing something in the background and not worrying about it taking
up memory for an extended period
|
Mark M. |
other than that, it's a pretty thin class
|
Jere_Jones |
Is there a way to look at the "queue" for
IntentService?
|
Mark M. |
it doesn't even know how to keep the phone awake,
which is why I've been steadily refining my WakefulIntentService
|
Jere_Jones |
Which I love!
|
Mark M. |
there are no public methods to examine the queue
|
Mark M. |
rephrase that -- there are no SDK methods to
examine the queue
|
Jul 6 | 8:55 PM |
Jere_Jones |
I'm thinking along the lines of a download queue.
|
Jere_Jones |
At the end of downloading one thing, it would call
startService for the next download. But I wouldn't want to do that if
the download was already in the "queue"
|
Mark M. |
the problem is that IntentService has a single
thread, not a thread pool like AsyncTask
|
Mark M. |
oh, you'd need to track that yourself
|
Jere_Jones |
AsyncTask vs IntentService? Both are "fire and
forget". When to use one or the other?
|
Mark M. |
just override onStart() or onStartCommand(), keep
tabs on the pending downloads, and chain to the superclass
|
Mark M. |
I don't know that you can answer that question in
the abstract
|
Jere_Jones |
"chain to the superclass"? super.whatever()?
|
Mark M. |
super.onStart() or super.onStartCommand(),
whichever you overrode
|
Mark M. |
that way, the normal IntentService logic continues
|
Mark M. |
but, you got notified of the item being added to
the queue, so you can track it
|
Jere_Jones |
Well, lets see. AsyncTask gives you an easy way to
get back on the ui thread. But you could do that in IntentService with
runOnUiThread, right?
|
Mark M. |
runOnUiThread() is a method on Activity
|
Jere_Jones |
I'm thinking about asynctask vs intentservice
|
Mark M. |
AsyncTask onPostExecute(), in theory, is on the
main application thread
|
Mark M. |
however, you have to create it on the main
application thread, so you would use that in a regular Service, not in
onHandleIntent() of an IntentService
|
Jere_Jones |
Yeah, because there may not be an activity around
while IntentService is running, right? Of course the same could be said
about an asynctask.
|
Jul 6 | 9:00 PM |
Jere_Jones |
Well, I've got 9pm here. I appreciate the time
you share Mark! Your books are great and I'm looking very forward to
the NDK book.
|
Bonnie |
Thanks, Mark :)
|
Bonnie |
And you too, Jere, for your input
|
Mark M. |
gadzooks! the time flies when you're looking
forward to getting doped up on NyQuil!
|
Mark M. |
I hates colds
|
Bonnie |
Hahaha
|
Jere_Jones |
Get better. Coding with a cold sucks.
|
Mark M. |
thanks!
|
Mark M. |
have a pleasant evening, all!
|
Bonnie | has left the room |
Jere_Jones | has left the room |
Mark M. | turned off guest access |