Jun 12, 2011

Android Reference Implementation - Droid Twit

In order to learn Android, we have created an Android application. This android application will help us get actual hands on experience in all the aspects of Android Development. The way we have developed this application is to thing of the design first, implement and keep refactoring the design, until the application gets better. Ofcourse we try to use the best practices mentioned on the Android.
We call this application as Droid Twit application, which is the reference implementation of Twitter on Android.

The application is developed in two parts
1. Small samples to understand a particular android feature or api
2. Integration of the feature or api in the Droid Twit application
The above approach helps developers to learn android

We have created an OpenSource Project

Please note this application is still under development, so please bear with us


This is an Implement of Android Twitter client. This is a reference implementation showcasing how to use all the components of Android to create a Twitter client.

Rohit Ghatol and Saurabh Gangarde are the lead developers of this project. Both of them work for QuickOffice and Synerzip Softech.

This Reference Implementation is build to train developers in Pune for one of the TechNext Technical Talks.


The tutorial on how to build a twitter client is available at DroidTwitTutorial

List Activity and Async Task Tutorial

Tutorial for List Activity and Async Task


The Android Client uses

  • Alarm Manager to repeatedly fetch tweets from Twitter
  • There is a back ground service for fetching twits and storing it in database
  • There is use of OAuth for authentication
  • Notification Manager is used for notifying users about newer twits
  • Battery Drain is monitored and Twitter Service is closed to help save battery, and when battery is charged then again Twitter Service is started. (Yet to be implemented- Coming soon)
  • In UI side we use shapes and drawable states for background and button images

Download Demo APK

Disclaimer: Since the application is under development and not gone through entire QA cycle, there could be some crashes in the application. We are striving hard to get you a stable version soon. Meanwhile please focus on the application architecture.

Please Download our apk from http://droidtwit.googlecode.com/files/DroidTwit.apk and try it.

Demo Video


Architectural Diagrams

Proposed Architecture

Screen Flow

Overall Architecture

Note Phone Boot Receiver, Low Battery Receiver and Alarm Receiver are all Android BroadCast? Receiver.

OAuth Authentication

First Time Launch

Activity Asking Service to fetch tweets

Alarm Manager Triggering Service every n minutes

When Phone Boots, Broadcast Receiver registers Alarm Manager and Battery BroadCast? Receiver

Battery BroadCast? Receiver controls Alarm Manager

Nov 30, 2010

Keyboard mapping for Android Emulator (on Windows)

Its easier to work with keyboard than mouse and hence every software provides keyboard short cuts for doing same action which is possible using pointing device. Android emulators also provides these short cuts. I gathered this information, here is the list

Emulator Action

Keyboard (Windows Platform)


HOME key


Page Up, F2


F4, F7

Launch browser


Trackball mode




Changing selection

Arrow keys



Activate 3G


Increase Ringer volume

Ctrl F5

Decrease Ringer volume

Ctrl F6

Change orientation

Ctrl F11, Ctrl F12

Run emulator in full screen


Nov 11, 2010

Adding Aspect to Android

Programming AspectJ with Android

AspectJ is the defacto choice for AOP program. So far I did not see any one trying AOP concept in Android. However, I did read one blog mentioning, it should be possible, hence I tried it.

AspectJ puts in pointcut across code and can execute advices around those pointcuts. The beautify of this is once you compile your java source, you add these pointcuts and advices to your program by injecting them in the byte code (of already generated class files).

Knowing this I knew aspectJ can be used in Android, as dex relies on .class files.

Stage 1- Let Java compile java to .class files
Stage 2- Let AspectJ compiler inject point cuts and advices to the .class files
Stage 3- Let Dex take these new class files and create .dex file.

There you should have AspectJ working for Android applications.

Case Study: Inject Tracing code to existing Android source.

Given the case that we have an existing android project, we want to trace the call graph of each thread (showing depth) and we also want to show the cumulative time for each method.

Step 1: Create an HelloWorld Android Project

Step 2: Add some code, so we can show some call graph

Run the program and you will see this on your android emulator

Also on the DDMS Log you will see

What we want to achieve?
We want to show the call graph for this flow. We know that the flow is this way

At the same time we would like to print the commutative time each method took

We would like to print this call graph by using AOP concepts. We would like to define pointcuts around all methods of all classes in package "com.test" and print these statements there.

Step 3: Add aspectjrt.jar to classpath of android

Step 4: Add Aspect file - Trace.aj

Following is the cut down version of the same Trace.aj file. See the inline comments

Step 5 - Compile using AspectJ

As we mentioned above we want to
1. Compile java to .class files using javac
2. Inject pointcuts and advices in .class files using aspectj compile
3. Compile these injected .class files into .dex file

For this we will use ant.

Here is the ant build.xml which I used to put aspectj compilation step between compile->dex target

Here is a snippet of my build.xml around compile and dex targets

Here is the complete build.xml for your reference

Run on command prompt or through eclipse

$> ant install

You should see following output for ant

Step 6 - Run the APK which has aspectj integrated into it (after ant install)

The log looks like as follows, just as we wanted.

Sep 11, 2010

AlternativeTo - Application Posted on Market

AlternativeTo is an Android client for the web service AlternativeTo.

AlternativeTo provides alternatives to popular softwares. Find out what are top alternatives for your favorite Browser or Antivirus.

Update 1 (10th September 2010):
- Added Filter by Platform and Filter by License
- Added capability to open website

I recently upload this application on Android Market. My intension is to figure out
1. Typical problems faced when writing android clients for web services or replicating web applications
2. Create Design Patterns and hopefully an Android Library to help write Android Clients
3. Share the same at Pune GTUG :)

Please visit AlternativeTo website for more details - http://alternativeto.net

Mar 19, 2010

Introduction to HTML 5

Introduction to HTML 5
  • History of HTML
  • Path to HTML 5
  • 5 Key strengths of HTML 5 - Canvas/SVG, Geo, Offline Cache an databases, Video and Web Worker
  • Code Samples
  • How to leverage existing Java Developers to build next gen applications on HTML 5

Speaker - Rohit Ghatol (
Linkedin Profile)

Venue - SICSR, Atur Center, 7th floor, Senapati Bapat Road, Pune

Jan 20, 2010

Seminar on Google Wave (Intro, Gadgets and Robots) on 6th Feb 2010 at Karve Nagar

Google Wave is a new model for communication and collaboration on the web, coming later this year.
Here's a preview of just some of the aspects of this new tool.

What is a wave?

A wave is equal parts conversation and document. People can communicate and work together with richly formatted text, photos, videos, maps, and more.
A wave is shared. Any participant can reply anywhere in the message, edit the content and add participants at any point in the process. Then playback lets anyone rewind the wave to see who said what and when.
A wave is live. With live transmission as you type, participants on a wave can have faster conversations, see edits and interact with extensions in real-time.

Seminar Topics
- Introduction to Google Wave
- Building Extensions to Google Wave
- Building Gadgets - Walk through of building a Gadget
- Building Robots - Walk through of building a Java based Robot
- Using GWT (Google Web Toolkit) and EXT GWT to create polished Gadgets

Presentation on Google Wave

Date - 6th Feb 2010 - 5:00 p.m to 8:00 p.m
Venue - Synerzip Softech - L5 (Terrace)
Dnyanvatsal Commercial Complex,
Opposite Vanadevi mandir,
Karve Nagar,
Pune, India 411052
Tel: 91-9923085006