Android part 6

January 1st, 2008 Comments Off

Happy new year all!

It’s time for a really big status report. After talking with some folk on IRC I’ve learned how to properly use ListAdapters and work their magic. Google really, really, likes polymorphism. Thats cool though.

I spent most my time during the day today (12/31) actually working on the buddy list. I was using some fairly complicated number juggling but after about 3 hours I got things to display in a … sort’ve right way.

So I got back from my new years part post 1AM. I said to myself, wow, this buddy list code is maybe 70 lines long, its ugly, horribly un-modifiable and i’m not confident the output it produces is 100% accurate. So, I commited to SVN for safe-keeping then scrapped it. All of it. About 6 hours of work writing/debugging down the tubes. We learn from our mistakes.

As you can tell, I’m writing this blog post at 2:40 and I’m not in a terribly sour mode. Yep, in a bit over an hour I’ve entirely re-written the buddy list (using vastly wiser data structures) and debugged it. Now not only is the code squeaky clean, and short; but i’m much more confident that the buddy list looks right.

So as of right now, I have 3 different AIM accounts signed on and its showing all their buddies in one big list. The actual “sign on” process takes a reasonably small amount of time; but collecting all of the “this buddy signed on” messages from AIM for some reason takes a bit longer than it should it seems. Will have to investigate and optimize.

Also, if anybody from google who is knowledgable in Android is reading this I have a question. Early on I was worried that I was sending too many intents from my network service; afraid some might get lost because the IntentReceiver was still busy handling the first one. So I wrote a queueing system: The network adds the intents to be sent to a queue and the messenger, in a round robin, when it completes an intent polls each network service for any intents it has left. If they have any, they get broadcast and de-queued. The system works 100% and I’m confident there is no Intent-back log. However, it does require some extra marshalled calls back and fourth; which are expensive. If I don’t have to worry about Intent-backlog I can scrap the whole system and save a handful of marshalled calls.