Announcing: Apps for Android

Screenshot of WikiNotes for AndroidWe are pleased to announce that a new open source project has been created on Google code hosting called apps-for-android. Our goal is to share some sample applications that demonstrate different aspects of the Android platform.



The first application to be included in the new project is called WikiNotes for Android.



For anyone not familiar with the concept of a wiki, it is a simple way to link up pages of information using WikiWords (words that use CamelCase). For example, in the previous sentence, both WikiWords and CamelCase would become live links in a Wiki, and would take you to pages of information.



WikiNotes for Android is a form of wiki known as a personal wiki. These run on desktops or (in this case) mobile computing devices, and many people like them. They bring a bit more structure to your notes than just a list of subjects. You can choose to link notes or pages up in any manner you like.



This particular implementation uses a regular expression to match WikiWords and turn them into links that fire Intents to go to other notes. Because of the way the links are implemented, the application will also create links out of telephone numbers that take you to the dialer and URLs that start up the browser.



Search by title and content is also implemented, so even if you forget the structure, you can still find that all-important note about where you left your car in the airport car park.



This wiki has a view mode and an edit mode. In view mode, the links become active and allow you to navigate to other notes, or to other activities like dialer and web browser. In edit mode, you see a plain text view that you can edit, and when you confirm the changes it goes back to view mode. There is both a menu entry and keyboard shortcut to switch to edit view, so that you can very quickly make changes. And, if you get lost in the note structure, there is also an option to take you back to the start page.



WikiNotes for Android was written to demonstrate a number of core concepts in Android, including:




  • Multiple Activities in an Application (View, Edit, Search, etc.)

  • Default intent filters for View/Edit/Search based on MIME types

  • Life cycle of Activities

  • Message passing via Bundles in Intents

  • Use of Linkify to add Intent-firing links to text data

  • Using Intents within an application

  • Using Intents to use an Activity within another application

  • Writing a custom ContentProvider that implements search by note title

  • Registration of ReST-like URIs to match titles, and do contents searches

  • SQLite implementations for insert, retrieve, update, delete and search

  • UI layout and creation for multiple activities

  • Menus and keyboard shortcuts



The application remains small in size and features to make it easy to understand. In time, more features will be added to the application to make it more useful, but a sample version with the minimal functionality will always be available for developers new to the Android platform.



If you believe that firing an Intent for every link that is clicked is sub-optimal and will waste resources, please take a look at the running application using DDMS. You will see how efficiently Android re-uses the running Activities and indeed, this is one of the main reasons WikiNotes for Android was written. It demonstrates that using the Android Activities and Intents infrastructure not only makes construction of component-based applications easy, but efficient as well.



There will also be a series of technical articles about the application right here on the Android Developer blog.



And please, keep an eye on the apps-for-android project, as more sample applications will be added to it soon.



Happy wiki-ing.

No comments:

Post a Comment