Sunday, March 23, 2008

Advanced Tab Activity Demo

I was inspired by the simple TabHost/TabWidget demonstration by Jeffrey Sharkey, and decided to expand upon it significantly. In my demo, I have replaced all the default drawables and layouts, created my own custom ColorStateList, and even utilized TabActivity for greater isolation.


Download: TabActivityDemo.tar.gz

The code and images for this demo are in the public domain, so please feel free to use and modify as you wish.

NOTE: TabActivity is currently marked as deprecated, but according to this post, I believe that may be in error.

Wednesday, March 5, 2008

Tool to read Android binary XML files

I have successfully reverse engineered a good portion of the Android binary XML file format that is found inside of Android package files (.apk). With this tool, you can explore the XML layout, drawable, and animation files used in the applications distributed with the SDK (phone, browser, contacts, etc). My primary motivation for doing this was to simply observe some of the common practices and get a sense for what Google is doing internally that isn't necessarily available through their API demos and samples. Below you can find two links to download either the stand-alone convertor or the collected output as run over every APK file found in the phone's /system directory:

Download: axml2xml.pl
Download: android-xmldump.tar.gz

Please note that this tool was a very quick hack and some of the XML files I found failed to parse. Not many, and the only ones I found were raw XML documents (not Android resources) so I didn't bother to explore any further incompatibilities. If you find any resources that fail to parse or have any insight into the format, feel free to leave a comment and I will investigate when I have time.

EDIT 2012-08-22: Android's come a long way since this post.  It's now possible to use the aapt tool to read the contents of XML documents (and a whole lot more) of APK files.  For example:

android dump xmltree foo.apk AndroidManifest.xml

Sunday, March 2, 2008

Custom Android list widget to access large sorted lists on touch devices

I have developed a custom Android widget for m5-rc14 that automatically (and efficiently) sections a sorted list by alphabet letters and offers a side-bar widget for quickly jumping to each section. This widget could be very useful for any project offering an extremely large list to the user, such as a music player showing artists or albums.

Some things left out with this widget are a smooth scroll to the selected position as well as a finer control for sections that have large item counts themselves. More to come later :)

Here's a screenshot using dummy data:



Download: AlphabetListView.tar.gz

Licensed under the GPLv2.

EDIT 2012-08-22: This approach represents very old design patterns for Android and has been broadly replaced by upstream components such as the fast scroll mode of ListView.