Android programming is on the rise and many developers are scared away from developing with it due to its complexity, This tutorial will guide you though everything as smoothly as possible

BE PREPARED!!

Well the first step is quite simple, you must be prepared before you go stumbling into the world of android programming. Here are a simple thing's you will need to know of have.

 

1. Java is the main programming language for Android, You won't need to know any of it for this tutorial however basic understanding of how code works will help out tremendously.
2. I will be going though these tutorials with a real device on hand, The google nexus 5 running android 4.4.2. Any phone that run android should suffice, I will not be showing you how to use the android emulator.
3. You need JAVA to be installed, here is a link to the latest jdk, download and install it.
4. Have a fairly good computer, i3 or greater is recommended/ minimum.
5. Have some time. 4 hours maximum depending on your internet connection speed

 

And that's about it...


Lets Start

Ok so we will need to download one more thing before we start, and that thing is called the android studio.
http://developer.and...o.html#download
Download and install that, Now when you run it it may have an error telling you to make sure you have the JDK installed, Let me quickly tell you how to fix that.

 

1. Navigate to you computer in the windows explorer.

2. Click on the computer properties (top bar)

3. Click on advanced system settings (Side bar)

4. Click on Environmental Variables (at the bottom)

5. Once there click new..., With the Variable name of JAVA_HOME (must be as named)

6. Navigate to the area where you installed the jdk (usually is C:\Program Files\Java\jdk1.8.0_20 or C:\Program Files(x86)\Java\jdk1.8.0_20) and copy the path.

7. Paste that into the paste that into the variable value form and click ok. And your done.

8. Open Android studio again this time it should open without a problem,

 

If you have a problem with the Path creation leave a comment, I'll do my best to help you though this part.


Opening Android Studio/ Setting up a project

When you open the Android Studio for the first time it will take a very long time to start up, dont worry I is just getting everything ready, Give it time, It may need to download a few things so don't cut the internet!

 

Once it has finished that it should display a screen with multiple options, what we want to do is to make a new project.

 

Chose a name for you application (Test App will do) And write what website it WOULD be on. soo. TestApp.ExampleCompany.com would be a good example.
Then click next

 

The next screen will allow you to chose what device version you will build for, chose from the drop down menu 2.3.3 Gingerbread, Why? well this is the standard lowest version of android most phones in the low performance range will run, so by choosing this your app will run on 99% of all phones on the market. Which is great! (the other tick boxes are not needed)
Click next

 

This screen will allow you to chose what kind of activity you want as the default, leave it as blank activity, many of the others may look cool but they introduce things that are very advanced and are hard to get you head around.
Click next

 

Now you can name that activity. I would recommend changing the MyActivity to MainActivity mainly because it makes more sense later on.
Click on finish :D

 

This should now create your project, after loading it all up It should look like the following image.

Quite confusing eh, well don't be worrying, you don't need to know half of it until later on.


Running the app on android

Now here comes the fun part! go ahead and expand the files so it looks somewhat like this.

This is all the files that you will need to edit or use later on

 

Now go ahead and open the strings.xml under the res/values files.

If you see something like this, you can change the black text to anything you want, change it to my first app on android. remember to same (ctrl + s)

 

Ok now before we go any further we need to set up you phone, make sure that you phone is in developer mode, ( If it is not go into your phone settings, About phone, and then click on the Build number 6 times, yes 6. It should give you a toast that you are now a developer) and have USB Debugging enabled (Go into the developer options and check enable USB Debugging).

 

Now plug your phone into your computer, if it recognizes it and allows you into its folders your all good, if not try unlocking (putting in your password on your phone) or searching online for your phones drivers and install them.

 

Ok now that all that is out of the way hop back into android studio and have a look at the toolbar at the top of the page, you should see a big green play button, press that! (make sure your phone is plugged in first) and wait for it to build (it can take up to 5 min to build depending on how slow your computer is, all builds after this will be faster).

Once it builds it should propmt you with a screen displaying what device you would like to run it on, chose your device (mine is the Nexus 5) and click OK.

In a few seconds it should push the app to your phone and run it. congratulations!!! you did it! you got your own custom app to run on your own device!

 

I will explain more about the actual coding later on, but for now you can stuff around with the strings and change all the names if you want just to see what it does.

Share


About the Author

Comments

5,396 Posts
3,746 Points

Marked   said 12th September 2014

Great tutorial! The only thing is that you've used gyazo for the screenies and eventually i think they'll be deleted, so there's technically an expiry date on this tut. Could you please use the asset manager instead? Its built into the tut editing screen.

97 Posts
369 Points

drago2308  said 13th September 2014

yea. I can, since I don't have any other program to take screenshots i used gyazo (lol didn't think of the assest manager after that...), I'll go back and download all those images and re-upload those to the asset manager (they will be eternal!)

 

Edit: They are now eternal!

36 Posts
170 Points

Yvy  said 13th September 2014

I loved it! I have a few knowledge of coding and always wanted to program something for mobile.
Thank you for sharing. I hope you make other tuts.

97 Posts
369 Points

drago2308  said 13th September 2014

@Yvy Thanks for the feedback!, and yes I will make more if people want me to, the next lesson will be going though basic buttons and events/functions. This will introduce simple coding and design pointers.

Quick Reply

Guest

Enter a username

Security check: What is 8 plus 2?