Sunday, April 26, 2015

Android Coding: How to start coding for Android

Hello everyone,

   Today I am going to show on simple steps how to start coding using Android app.

1) First of all you need to download the Android studio that is basically the Eclipse( modified for it) at https://developer.android.com/sdk/installing/index.html?pkg=studio

2) Run the file  android-studio-bundle-141.1980579-windows.exe


3) Install the SDK from Oracle to allow you use java.sh or .exe





4) Choose components that you are going to use.

5) Define where you are going to install them


6) This is a very important step: You are going to define how many GB are you allowing for Android Emulator. Please note that this can affect your machine performance depending on the size of your project.




Installation completes successfully

7) Running Android Studio


8) Next step is create your own Android Java Project







Now that we have our project created, and you can start modifying it ,creating some interactions for your user.

9) On this example we are going to create one regular button that calls a textView to be displayed.

So, here it is our project screen:


10)First of all, we are going to create our button called button, and out text to be displayed called textView1. Once they are created into Android display, you should be able to see them on our main activity.xml(called activity_fullscreen_thiago_leoncio_blog.xml) as below:
  

11) This step now we are going to create the action on the java class called FullscreenThiagoLeoncioBlogActivity.java

//Please note that you should import the TextView from android.widget.TextView.


12) Now we should return to our main xml activity file called activity_fullscreen_thiago_leoncio_blog.xml, and make sure the button we added has the onClick action related properly added.




Now you can save your code and launch your Android emulator clicking on the green arrow (run button).

Choosing the type of device you want to emulate.

then click


...and if you click on this button.....


  On TOP the message that we wrote on onBtnTouch method





I hope it helps you.I am going to provide more articles related of mobile development next month.

Happy coding. Please send me an e-mail if you want this sample code.

Cheers,
Thiago Leoncio.