How To Become An Android App Developer: Getting Started In Android Software Mobile App Development

Making Android Apps

If you are a complete beginner and haven't got the first clue about Android or Java development or any sort of computer programming, I recommend you take a look at 'How To Not Become An Android Developer' first, so that you know what to expect when setting up your development environment.

On the other hand you could choose to go down the easy route and take heed of the advice in my article entitled 'How To Make Your Own Android Apps' - this is not recommended if you plan to take your Android software development to a professional standard, although the paid subscription plans do provide a very convenient and cost effective solution, considering the price of paying a professional Android app developer.

Getting Started

Android is based on Java, therefore in order to develop Android apps you will need a Java IDE (Integrated Development Environment).

Most developers choose Eclipse as their IDE although JetBrains IntelliJ IDEA is another excellent IDE which I prefer to use myself. Once you have this software installed you are almost ready to start developing Java applications.

However, first you also need to ensure that you have all the necessary Java utilities installed on your system.

This means you will also need the Oracle Java SDK (Software Development Kit) and the Java Virtual Machine (JVM) also known as the Java Run-time Environment. Without the Java Virtual Machine your applications will be unable to run on your system.

One you have the above software installed and have configured your system, this will then allow you to develop Java applications.

However, in order to develop Android applications you need one more vital piece of software - the Android SDK.

Alternatively, you may choose to develop your applications on your Android device which actually makes getting setting up a lot easier.

In order to develop Android apps on your Android smartphone or tablet device you need just one piece of software called AIDE (Android Integrated Development Environment) which can be downloaded from Google Play (Android Market).

By developing directly on your Android device you will also have the advantage of being able to test your apps without having to set up a virtual device (emulator), as you would on a PC.

Creating A New Project

When you create a new Android project in your IDE, the project will automatically be given the correct folder/file structure which should look similar to the image on the right.

In order to develop your first Android project you will need to understand what the files/folders are there for.

For your first project you will mainly need to concentrate on the 'res' folder, the 'src' folder and the AndroidManifest.xml file.

The 'res' folder: This is where your resources go. Generally this will be things like page layouts, global string data (more on this later) and user interface.

All these files are stored in XML format.

The 'src' folder: This is the folder where all the Java source files (known in Java as activities) are stored.

This is where the underlying Java code of your Android app will be stored; the code that makes your app functional.

The AndroidManifest.xml file: You may have noticed that whenever you install an Android application on your device, the app tells you what permissions it requires before being installed.

Any permissions required by your application must be declared in the AndroidManifest file.

In addition, whenever your app uses an intent (more on this later), an intent filter must also be declared in the AndroidManifest file.

Developing Your First Android App

After creating a new Android project, you should have been presented with a tab displaying the Java code contained within the MainActivity.java file.

If you have not, then go into the 'src' folder and double-click on the MainActivity file so that the code is displayed.

The code should look something like this:

package com.companyname.appname

import android.app.*;
import android.os.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class MainActivity extends Activity

	{
		/** Called when the activity is first created. */
		@override
		public void onCreate(Bundle savedInstanceState)
		{
			super.onCreate(savedInstanceState);
			setContentView(R.layout.main);
		}
	}

The only lines in the code that you really need to be concerned with at this point is the line that says:

setContentView(R.layout.main);

To explain, what this line does is set the layout of the MainActivity screen. The actual layout is stored in the main.xml file which is contained in the resources (res) folder.

The 'R' which is referenced in the code refers to an automatically generated file that indexes all the resources that your application uses.

The 'R' file should never be edited manually.

The MainActivity java class is the screen that will first launch when your app is opened after being installed and is therefore often used as a splash screen.

However, for the sake of this tutorial we will use the main.xml file as a user interface which displays upon launching the app.

Creating The User Interface

When your application is launched the information contained within the main.xml file is displayed on the screen.

Go into the 'res' folder then the 'layouts' folder and double-click or open the 'main.xml' file so that a tab opens and/or the XML code displays on the screen.

The main.xml file will contain code that looks something like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	android:orientation="vertical" >

	<TextView
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:text="@String/hello" />
</LinearLayout>

Notice that within the <TextView> tag, a string resource named 'hello' is called from the Strings.xml file which is stored in the 'values' folder. The 'values' folder is stored inside the 'res' folder.

If we open up the Strings.xml file we can see a line of code that says something like:

<string name="hello">Hello World, MainActivity!</string>

So, essentially, when your app is launched the MainActivity file opens up and imports information from the main.xml file which then tells the activity to display the text which is stored in the "hello" string (ie "Hello World, MainActivity!").

If you changed the line of code to say:

<string name="hello">This is my app</string>

then the text "This is my app" would be displayed on the screen instead.

A string is simply a way of storing information and can be named anything you choose.

To create the user interface we are going to use three buttons which you will need to draw yourself - Start, Options and Quit.

For the sake of learning you can use a program as simple as MSPaint if you wish. However, you will need to consider the fact that Android devices come in various sizes and screen resolutions and for this reason, inside the 'res' folder there are also folders named 'drawable-hdpi', 'drawable-ldpi' and 'drawable-mdpi'.

As the folder names suggest, they are for high definition, low definition and medium definition images in order to cater for various screen resolutions.

When you have finished drawing your three button images, save them as either JPG or PNG files and place a copy of each image in all three of the 'drawable' folders ensuring that the files names have the appropriate .JPG or .PNG file extension.

Make sure to name the files start, options and quit.

It should be pointed out that Java is case-sensitive so you should be extra careful when writing your code.

Also, images should be of the highest resolution/size possible so that Android can cater better for the various device screen sizes when your app runs on them.

Displaying your three button images on the opening screen of your app is simple.

All you need to do is add the following code to the main.xml file:

<ImageButton
	android:layout_width="fill_parent"
	android:layout_height="wrap_content"
	android:src="@drawable/start" />

<ImageButton
	android:layout_width="fill_parent"
	android:layout_height="wrap_content"
	android:src="@drawable/options" />

<ImageButton
	android:layout_width="fill_parent"
	android:layout_height="wrap_content"
	android:src="@drawable/quit" />

As you can probably see, the <ImageButton> tag sets the height and width of each button and the android:src command retrieves each button image from the relevant 'drawable' folder.

Make sure to save your project.

Upon running your application, as long as the above procedures have been followed correctly, your three image buttons will be displayed on the screen - Congratulations!

However, your buttons are not yet operational... but you have learned how to display images and text.

Making the buttons functional is actually slightly more complicated and needs a bit more explanation so I have explained how to make them functional in another article (see link below).

Next: Making The Buttons Functional

© 2012 Sparkster Hubs

More by this Author


Comments 8 comments

Gamerelated profile image

Gamerelated 4 years ago from California

Excellent work sparkster. I would love to learn how to develop Android apps. I did read your article on how not to be a developer. After reading that I gave it more consideration. I will be on the look out for your other articles on Android.


sparkster profile image

sparkster 4 years ago from United Kingdom Author

Thanks. Android can be quite daunting at first but I've persevered with it and I've now managed to figure most of it out.


ib radmasters profile image

ib radmasters 4 years ago from Southern California

sparkster

Can all of these tools be obtained FREE?

And are there any special requirements for your computer development system?

Thanks


sparkster profile image

sparkster 4 years ago from United Kingdom Author

Hi ib radmasters,

Yes, all these tools are free. However, AIDE does require the purchase of a license key before it allows apk publishing. It's still usable without a premium key though.


sparkster profile image

sparkster 4 years ago from United Kingdom Author

Also, I would recommend at least 1GB of RAM with a 60GB hard drive absolute minimum.


germs 3 years ago

hey man im really interested in this. can i really make an app from my android and will i need anything else for my computer. im looking for a new laptop asap.


sparkster profile image

sparkster 3 years ago from United Kingdom Author

Yes, you can make an app just using your android device. However, you may need to use a pc to transfer files you want used in the app or to draw graphics.


Melissa Rutala 2 years ago

Pretty nice post for android development newbies, it will be great if you could share an article elaborating step by step process of setting up and configuring machine for android app development.

Melissa

www.kiwitech.com

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working