Creating A Toolbar In Android - Day One

Introduction

Today I am starting with the very initial stage of Android app development, and furthermore I will try to make a series of articles on it. My article is basically project based; when you start to read my article just follow me and hopefully in the end we will develop a small Android app, but you also should have a good concept of Java, and especially object-oriented programming, because overall Android development depends upon Java so it is mandatory that you have knowledge about it, and if you have the core concepts of object-oriented programming then this is a plus. Now I will start at the very beginning and discuss all of the mandatory steps which you are facing.

Step 1:

Now double click on the Android studio icon which is appears on your desktop; after this you can see this type of window; now click on "Start a new Android Studio Project".

project

Step 2:

Now choose your app name and company domain. It is mandatory that you choose a domain name which is uniquely identifiable.  Domain refers to your website; if you have your own website then your package name is uniquely identifiable and if you can't give a unique package name and you build the app but you publish the app on the Playstore it will give an error that your package name is not uniquely identifiable and your app will not be publised, and after this you will face too much difficulty to change the package name. After this also select the project location.

new

Step 3:

Now you can select the minimum target SDK to run your app, it depends upon you, but there are two factors which are very important about the minimum SDK. The first is that if you make a project for the client then you set the SDK according to the client's requirements; second, if you make your own app as a product then search the statictics of which Android operating system  is very popular and will reach a bigger audience,  then set SDK, and if you want  your app to also run on Wear and TV then check the check and set the SDK version.

sdk

Step 4:

Now select the activity. Now I am chosing Blank Activity, because we are starting from the beginning but you should be awareof  the other activites because they are very useful.Now click on next button.

activity

Step 5:

Now it depends upon you which name you give but at this time we set the default name and click on finish button.

customize

Step 6:

Now we make some changes in our project go the activity_main and change layout in your project you see the relative layout; replace it with linear layout and make some more changes in it.

xml

Step 7:

Now we go to the styles.xml file and set some item colors. Here is the code if you make some changes,

style

Step 8:

Now move to the MainActivity file and add this code On OnCreate method and paste the two lines of code in it then save the program and run the project.

main activity

Step 9:

Now when you run the app you see that the toolbar appears with its respective color, but if you think that this only changes the appearance of our project the answer is not in the future, you will see that is why we choose Linear layout.

result

Read more articles on Android:

Up Next
    Ebook Download
    View all
    Learn
    View all