Developing for webOS versus Android
Posted on 2011-08-29 13:20:00
Tags: essay palmpre projects programming android
Over the weekend, I spent some time working on porting LJ for WebOS to Enyo, and after I got stuck there, I worked on porting FlightPredictor to Android. Since I was developing in both environments, I thought I'd give some more thoughts on Android (here's part 1):
I'm definitely learning more as I go, but there are still some areas (well, most areas) that developing for webOS is way easier than Android. I admit I'm biased in the matter since I've done a ton of webOS development, but sheesh:
- The Eclipse I'm using is decent in some ways and really frustrating in others. (I'm using MOTODEV Studio, because...well, I had an email from them and I just picked something) Keep in mind I'm used to developing in a text editor so the bar's pretty low here. It took me a while to realize that when you start debugging something you then have to switch to the "Debug" perspective to actually see what's going on. And 90% of the time when the app crashes, the only info I can see is that a RuntimeException was thrown, somewhere. (even when it's something easy, like a NullPointerException in my code!) Worse is when none of my code is on the call stack and I don't have the Android source code, so it gives me very little idea of where to start looking.
Honestly, the Intellisense is nice, but it just doesn't feel quite right, and often gets in my way. Hopefully as I get used to it I'll stop fighting with it so much. And the emulator is slow - it takes 15-20 seconds to get from pressing "Debug" to the app actually starting, and given the limited information I get back from the debugger it's almost not worth doing. (although if I know where the problem is, I can set breakpoints, etc., which is nice)
- To include a big list of structured data (i.e. a list of airlines), for webOS I just have to include a simple .js file assigning a big JSON array to a variable. For Android I have to generate an XML file (or a JSON file, I guess? Didn't try that...), and write initialization code to parse the XML file and store it.
- In webOS, doing an asynchronous web request is drop-dead simple - just use an XmlHttpRequest! Yay! In Android you have to spin up a new thread and post messages back and forth and such. Just reading that section of the book I'm borrowing depressed me, and I'm sure when I get to that it will suck.
- I wanted to have a Spinner (a list selector) that displayed a string and would return the associated value if it was selected. You know, like EVERY LIST SELECTOR EVER. Except, no - you can easily display a Spinner with a list of strings, but if you want to do something crazy like associate a value with it, you have to implement some interface and things generally get more complicated. What's so hard about a freaking templatized value type?? This makes me angry.
Anyway, nothing so terrible that I'm giving up, but a lot of annoyances and I really have to be in a tolerant frame of mind or I will start throwing things and cursing.
Comment from yerfdogyrag:
I've only done a little with it, but I thought you could just do a:
EasyHttpClient client = new EasyHttpClient();
To do a remote request if it's OK to block where you are.
(Note: taken from http://www.androidsnippets.com/get-the-content-from-a-httpresponse-or-any-inputstream-as-a-string )
BTW, interested in: http://bigandroidbbq.eventbrite.com ?
Comment from gregstoll:
What's the EasyHttpClient? Looks like it might be this code? That is a handy class - thanks! (I'd still have to spin up a thread because I don't want to block the UI while waiting on a remote server...)
Ooh, and androidsnippets.com looks pretty helpful too...
Hmm, interesting, I'll have to check my schedule. (are you going?)
This backup was done by LJBackup.