Date Archives

February 2014

Getting Started on Android Development

Android is an amazing and fun platform to work on. Anyone can come up with their own unique idea, create a good product and make it available to thousands and thousands of customers. Welcome to a huge world of development and progress in the mobile age.

Android has greatly matured in the last few years. There are over a thousand tutorials out there so you are spoiled for choice. So let’s get this party started.

Getting Started

Google has gone out of it’s way and created more than a guide for you. The  Android Developers Handbook . It has almost everything you need to know and very well explained sample programs, so make it your best friend.

Setting Things Up

Before we start with the installation process first verify that your computer meets the basic system requirements.

Step 1: Verify JDK is installed

The first step is to check if you have the JDK (Java development kit) installed. Don’t confuse JDK and JRE. JRE (Java Runtime) is needed for running Java programs. JDK (Java Development Kit), which includes JRE plus the development tools (such as compiler and debugger), is need for writing as well as running Java programs. Since you are supposed to write Java Programs, you should install JDK, which includes JRE.

  1. Open Command Prompt in Windows or Terminal in Mac and Linux.
  2. Type “java -version“.

You should see the following:

terminal
If for some reason you do not have Java installed, you can download and install it from Oracle.com.

Step 2: Get The SDK

Download the Android SDK provides you the API libraries and developer tools necessary to build, test, and debug apps for Android.It includes the essential Android SDK components and a version of the Eclipse IDE with built-in ADT (Android Developer Tools) to streamline your Android app development.

The following resources are in the  ADT Bundle:

  • Eclipse + ADT plugin. The ADT Enables you to create Android Application in Eclipse.
  • Android SDK.

Once downloaded, unpack it and put your Android SDK in a safe spot since you’ll be using it a lot. This is optional but i like to keep my computer organised.

Go to the tools folder and double click the android executable. This will open the Android SDK and AVD manager. The Android SDK Manager allows you to install and delete Android packages. Ensure you have selected the at least the latest API version. It is advisable to build your applications with the latest API as the Build Version. Click install.

This might take sometime depending on your internet speed. So join me and let’s finish some side missions in Assasin’s Creed 😀 .

android AVD

Step 3: Choosing Your IDE

There are a couple of IDE’s out there which you can use to develop your Android Applications. I will mention the most used IDE’s. My Favourite is Intlellij for a 1000 + 1 reasons which i will share with you in another post. I would recommend using the IDE that is in the Android ADT Bundle.

  1. Eclipse
  2. Android Studio
  3. IntelliJ IDEA

Almost Done.

We are almost there. Don’t give up. We no need to link Eclipse to the SDK.

  1. Open Eclipse
  2. Click on Window > Preferences.TitleBar
  3. You should see a Window like thispreference
  4. Click Android, on your left and you should something close to this. You will not see the Android Version but it’s ok.preference_android
  5. Click Browse and Navigate to where you put downloaded your Android ADT Bundle. Open it, You should see two folders. Select sdk and click ok/open.preference_browse
  6. Once that is done click apply, then OK.

Misson Complete. 😀

The End,Finally

I hope i did not scare anyone away. I’m assuming you have successfully installed everything. If you have give yourself a pat on the back else slap yourself. I mean it..haha. In the next post will show you how to create your first Android App or you can go ahead and learn.

Happy Coding!

index_landing_page

 

Java Programming Style Guidelines

I have been programming  in Java for a while now. I have learnt a few tips along the way from reading peoples code and of course the internet. Join me and i will share what i have learnt.

I have had a “discussion” with a couple of Developers on using Naming Conventions.  A friend of mine told me, “As long as my code runs the rest does not matter”.

Different programmers can have different styles and approaches to the way they program. The whole idea of using Naming Conventions is to make your code more readable to you and other programmers. Whether you are working in a team or not, Code Readability is important because you will spend less time trying to figure what the code does, leaving more time to debug or modify it. Team members are more likely to share and re-use code when the style and commenting conventions among team members are the same.

A common naming convention in programming is CamelCase. This is a naming convention which a name is formed of multiple words that are joined together as a single word with the first letter of each of the multiple words capitalised so that each word that makes up the name can easily be read. In programming the first letter is a lowercase. e.g emailAddress, homeAddress.

General guidelines to apply when choosing Identifier Names in your programs:

  • Avoid using Abbreviations. Use names like firstName, emailAddress, middleInitial rather than fName, mInit.
  • Avoid names that only differ in case. e.g  person and Person.

By using meaningful names, you go a long ways towards writing self-documenting code. That is, code that is understandable on its own without requiring accompanying comments. Example.

 

Variable Naming Conventions

Use meaningful names that describe what the variable is being used for. Avoid generic names

Constant Naming Conventions

When naming constants, use ALL_UPPER_CASE for your named constants, separating words with the underscore character. For example,

Method Naming Conventions

Methods names should be in mixed case. Use verbs to describe what the method does.

Last but not least, always remember to use Comments in your code. Comments provide readers with the information helpful to understanding your program.

There are three basic types of comments:

  • File header comments: Provide identification information about the program and author.
  • Single-line comments: Provide overviews or summaries of chunks of code.
  • Trailing comments: Provide information for one line of code.

 

Remember, you should write your code with the aim of making it understandable to others. Others will need to read and understand your code and one of the major keys to understanding is through the use of meaningful identifier names.

Now go and make your code Readable if.