In this post I will walk you through the creation of first android project - "Hello Android".
Step 1: Download "Android Studio" from here and install it.
Step 2: Open Android Studio click on “Start a new Android Studio Project” from the start up screen
Step 3: In the following screen give an Application Name and the click next
Step 4: In this screen, as I wanted my project to support earlier versions of android beginning from IceCream sandwich, I chose API14 as my “Minimum SDK”. Based on your need you may select the version. Then click next.
Step 5: In this screen although there are many options to choose from, as I have observed that there are many problems that others faced by selecting all those beautiful looking activities, I prefer choosing a “Blank Activity” or “Add No Activity”. For this tutorial, I chose “Blank Activity”. Click your desired activity and click next.
Step 6: Here give the Activity a name and click finish.
Step 7: After the completion of above step the project should look something like this.
Step 8: Now, click on “Edit Configurations” from the top tool bar.
Step 9: From the configurations screen, make sure that “Show chooser dialog” is selected. This helps you to choose the emulator each time you run the app. You may also configure the emulator if you haven’t done that already. Follow this link for the instructions on how to configure the android emulator. I use Genymotion as my emulator as it is faster than the native android emulator and it is absolutely free. Click here to know how to install Genymotion.
Step 10: Now from the top toolbar click “Run ‘app’“
Step 11: A dialogue screen pops up from which you can either choose any running device or select “Launch emulator” and select the device. If you don’t want to take any risks installing the Facebook app on your emulator, you may connect your phone directly by turning on the developer options on it. [Click here to go to the tutorial on turning on the developer options on your phone]. From the screen select your device/emulator and click “ok”. In my case it is “Genymotion Samsung Note 3”.
Step 12: Hurray!! After the build process this launches the app on your emulator/device.
Step 13: You are right!! there is nothing that we did manually so far. These are the basic initial steps to make sure if everything is in place. Lets do a small change to the Hello World. Lets make it Hello Android. All the strings that we use in the application can be placed in a file named "strings.xml"
This file is located at :
This file should look something like this:
Step 14: Now, if you observe this file, there are 3 main strings that can be referenced elsewhere in the application. Lets add another string for "Hello Android!!"
Step 15: Let's replace the "Hello World!" from step 12 to "Hello Android!!". To do this, we have to open our application activity, which is located at:
The default activity file should look something like this:
If you observe from the above code, I have commented the existing "TextView" and added a new one. The line "android:text="@string/hello_android" does the trick. In Android development, to reference a string that is in the "strings.xml" file, we use the following structure:
Step 17: Final Output
Post a Comment