Monday, January 12, 2009

Playing with the Android source: Bookmarker



Since Christmas I've been wanting to achieve 2 small goals (1) get to grips with the Android OS Source code and (2) make another Android application.

As is usual with these things I've started but not finished 6 android apps, various things from a Newtons Cradle model to a Comic strip reader, the former sent me right back to maths class. The application that I decided to complete first was a tiny tool which allows you to re-order the bookmarks in an Android devices web browser.

So how do you go about replicating the bookmarks page of the web browser on Android? well it is pretty simple - you go to the Android source code at http://android.git.kernel.org/ and scroll down to platform/packages/apps/Browser.git where you are free to browse the source of the various branches of the android web browser from Release 1.0 upto and including the cupcake branch. Dig a little deeper and you end up at BrowserBookmarksPage.java. Now you can create a new project in eclispe download the appropriate source files (BrowserBookmarksAdapter.java is the key to it all) and marvel at how powerful open source operating systems really are.

Add a couple of buttons over the top of the ListView to enable moving, deleting and launching of the bookmarks and really it is a suprisingly quick and easy app to knock up. Although admittedly a little more attention could make it a lot prettier. You also need 2 permissions in the manifest file to get read/write access to the bookmarks
<uses-permission name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"></uses-permission>
<uses-permission name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"></uses-permission>

This time I have released the project source code on Google Code, the project is called AndroidBookmarker at http://androidbookmarker.googlecode.com/

On a side note if you have any experience modelling balls on peices of string then I'd like to talk to you, this Newtons Cradle app is doing my head in, angular velocities, gravity, momentum, agghhhhhh.

3 comments:

Martin said...

tried this ? http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=824.0

Chris said...

Love the Bookmarker application. It would be perfect if there was an option to alphabetize!

Anonymous said...

big thanks to the author for new)