Help coderanch get a
new server
by contributing to the fundraiser

Ed Burnette

Author
+ Follow
since Jun 10, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ed Burnette

I did some iPhone vs. Android development comparison articles during an iPhone class I took in November. You might find them useful:

http://blogs.zdnet.com/Burnette/index.php?cat=39
15 years ago
From page 65 (75 in the pdf):

What Size Is It Anyway?

A common mistake made by new Android developers is to use
the width and height of a view inside its constructor. When
a view’s constructor is called, Android doesn’t know yet how
big the view will be, so the sizes are set to zero. The real sizes
are calculated during the layout stage, which occurs after
construction but before anything is drawn. You can use the
onSizeChanged( )method to be notified of the values when they
are known, or you can use the getWidth( ) and getHeight( )methods
later, such as in the onDraw( ) method.



Hope that helps.
15 years ago
I made the changes above in my copy and it worked fine. Of course there's some bad recursion going on (an activity launching itself) but I assume that's just temporary code for demonstration.
15 years ago
I cover the application/activity lifecycle but not the service lifecycle. And only the simple things, not singleTop and singleTask, sorry. I haven't found a use for them yet.
15 years ago
Congratulations to the winners, and thanks to everyone for having me. It was a blast!
15 years ago
No, but that sounds like a good topic for an article. In a nutshell here are the steps:

1. (1 time) Get an Android Market account. It costs $25.

2. (1 time) If you're going to charge for the application create a Google Checkout merchant account.

3. (1 time) Run a java command to create your public and private keys.

4. Export your .apk file into some directory.

5. Run a java command to sign your .apk file with your keys.

6. From the Market Developer Console, click on 'Upload Application' and follow the directions.

Et voila! In a few minutes your application will show up in the Market in all supported countries.
Note: You can't buy your own application. It's a known bug.
15 years ago
There are two problems in the code:

1. The two text fields don't exist in the original activity so they're being set to null. You need to find them in the view that you inflated, like this:

2. getText() is returning an Editable object. Usually you can use Editable wherever you use a String because they both implement CharSequence, but not in this case. Sorry I forgot to mention this earlier. The fix is to call toString() in the middle like this:
15 years ago
Ok I understand your question now. Android is a complete software stack, starting just above the metal. It might be possible to run Android in a virtual machine (like you can run Linux or Windows with Xen or VMWare, or the way the Android emulator runs on a host OS) but other than that, Android is currently designed to be alone on the hardware device and not "run on top of" any other layer of software.

15 years ago
... What he said.
15 years ago
There's a little on threading in the communications chapter (doing network I/O on a different thread). I recommend Brian Goetz's book, Java Concurrency in Practice, for a deep dive on threading. I have a signed copy, and you can't have it.

IMHO threads are over-used. I'm guilty of doing this too. As a rule of thumb there should be one, maybe two threads per CPU core. If you have more than that you're just inviting problems with contention, switching overhead, and memory.

I'm not aware of any feature in Android that will kill certain threads but leave others running. Check your exception handling carefully and use the Log.d() and Log.e() functions to see what's going on, and simplify the program to eliminate unnecessary threads.
15 years ago
Using the system table is definitely not the recommended way to do things, and it's undocumented and subject to change with each release. That said, there are probably some interesting things in there if you find yourself bored one afternoon. Personally I'd rather take the time to read the source. Or to keep up with Android forums.
15 years ago
That list looks out of whack to me. Readers seem to agree with me, because i noticed it has 402 No votes to 90 Yes votes at the bottom.
15 years ago
I lucked out because I was already on T-Mobile (after they bought SunCom) and my old 2-year contract had run out. So I upgraded from a Blackberry and swapped the SIM card, in return for re-upping for another 2 years. Unfortunately they don't have 3G in my area, but 2G plus the occasional WiFi works well enough.
15 years ago
Dalvik is one implementation of a Java virtual machine. Sun has another one as part of Java Standard Edition, IBM has one, and so forth. It's surprising how many there are.

For my take on the Sun/Google Java "fight" read this: http://blogs.zdnet.com/Burnette/?p=469
15 years ago