Start by launching Android Studio and clicking “Start a new Android Studio project”.
In this tutorial we’ll just be using this application as a demonstration so configurations such as Application name and Company Domain don’t really matter, but I will show you what I’ve used anyway. More reading on Naming a Package.
For most of my beginner tutorials I will be using the Phone and Tablet SDK as well as API 15 (IceCreamSandwich) for its compatibility. In future tutorials if I use a higher API it will be because that API is required for some functionality used in the application.
Most of the tutorials I will be creating will start with an “Empty Activity” template. I find this way we can learn what is required of creating other functionality.
Final screen… I’ve decided to change the Activity Name to FirstMainActivity for learning purposes, so we can see what’s generated. Notice when changing the activity name the layout name will change automatically.
Once Android Studio has completed its project creation process, you should be greeted with a screen much like the following.
Try running the application and see what happens. If you have your phone connected to your development machine you should have it in the list of devices to deploy your application too. If not, you’ll have to use an Android Virtual Device.
Once deployed to your device of choice you should see the application appear.
So there are a few things to make note of. Remember how we changed the activity name from MainActivity to FirstMainActiivity? This change can be seen in your java directory of your project. The activity is a class in Java used to describe features and functionality of the window.
You may think the title should read FirstMainActivity instead of FirstActivity but the title is the application name and can be set in the res/strings.xml file. Notice the name of the string is app_name. Doing a quick find for app_name (Ctrl+Shift+f) leads us to the AndroidManifest.xml file. In the AndroidManifest.xml file we can see the label is set to the value of @string/app_name value. Changing either the value of app_name in the strings.xml file or the value of android:label in the application node of AndroidManifest.xml will change the title of application. It is probably good practice to stick to using resources though, it will save lots of time if you ever need to add another localization to you project.
We’ve now completed our first project. It doesn’t do much but this is the first step towards building more complex applications.