Developing android applications

I have just published an application on the android marketplace, you can scan the bar code or click here to install it.  This application was created as a training exercise so is not very complicated.  The application will convert miles per gallon (imperial) to litres per 100kms.

The whole android development process is well documented on the internet and if you have java experience you are off to a flying start.  There is very little required to get started and the only cost is a $25 registration fee if you wish to publish on the android market (this is not required for developing).

I have used Linux and Windows to test the developers kit and it works fine on both.  It also runs on macs but I haven’t tested this personally.

Eclipse appears to be the most popular ide for developing android applications and is well supported with install guides and help for any typical problems you might encounter.  The other download required is the android developers kit (ADK) which is available from

Here are a few locations with guides for installing Eclipse and the ADK – or

Here is a code snippet from my application, I will update this post as I develop the application further a learn more about this platform.

import java.text.DecimalFormat;
import java.text.NumberFormat;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.RadioButton;

public class Litre2MPGActivity extends Activity {
	private Button btn;
	private TextView tv;
	private RadioButton r1;
	private EditText et;
	private double myValue;
	private NumberFormat myNumberFormat;

    public void onCreate(Bundle savedInstanceState) {

        btn = (Button) findViewById(;
        tv = (TextView) findViewById(;
        r1 = (RadioButton) findViewById(;
        et = (EditText) findViewById(;
        myNumberFormat = new DecimalFormat("#,###.#");
        btn.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Perform action on click
            	if (r1.isChecked()){
            		myValue = 282.5/Double.parseDouble(et.getText().toString());
            		tv.setText("your l/100 is " + myNumberFormat.format(myValue));
            	else {
            		myValue = 282.5/Double.parseDouble(et.getText().toString());
            		tv.setText("your mpg is " + myNumberFormat.format(myValue));
            	catch (NumberFormatException e)
            	new AlertDialog.Builder(Litre2MPGActivity.this).setTitle("Error" )
            	.setMessage("Enter a number")
            	.setPositiveButton("OK", null).show();


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.