1. Home
  2. Training Library
  3. Programming
  4. Programming Courses
  5. Exploring Android Studio Interface

Introduction to Manifest Files in Android App Development

Start course
Overview
Difficulty
Intermediate
Duration
1h 19m
Students
1
Description

In this course, we will examine the interface of Android Studio and explore the Gradle Build system, manifest files, and resources such as strings, drawables, etc.

Intended Audience

This course is ideal for anyone who wants to learn how to use Kotlin for developing applications on Android.

Prerequisites

This content will take you from a beginner to a proficient user of Kotlin and so no prior experience with the programming language is required. It would, however, be beneficial to have some development experience in general.

Transcript

All right. Hello everyone. So let's talk about the Android Manifest File just for a minute. Alright, so Android Manifest file. This is an XML file, one of the most important parts of the Android application project. We can access the basic information of our application from this file. We can also get the basic permissions for the application in this file. So, after this basic information about the Manifest file, well, why don't we just get to Android Studio and we'll talk about it as we go along? So, I'll open up Android Studio. Now, first of all, let's close the greater windows that we opened in the previous lesson if you've still got them open. So, to do that, you just simply click on the 'X icon' next to the tabs.

Now, let's open the project directory as well. So, you can find the "Manifest" file under the app folder on the left side of the Android Studio. So, when I open up the 'Manifest file' and you can see that it's extension is ".xml". Now, if you look at this file carefully, you're going to see the package name is "com.example.myandroidproject". Ring a bell? We spoke about that package name before. Alright, so let's examine some important lines here. So, want you to notice there are two lines here. The "android:icon" and the "android:roundIcon". So, we determine the icon of our android application on the phone in these lines. Now before, API level 25 there was only the "android:icon" feature, and app icons could be displayed in square form, but as of API 25, the "android:roundIcon" feature has also been at. Therefore, your app icons will appear square on phones prior to API level 25, and round on phones using API level 25 and later, okay?

So, adding icons is also very easy actually we'll learn about this in greater detail coming up, but I just wanted to briefly touch on it, and I'll show you how it works. We'll choose a picture for our Android application, after that, we put this picture in the "bit map" folder, and we write the picture name on this line. And if we do not choose any picture for our application by the way, Android Studio chooses a default icon and that is the Android robot icon. Alright, so the other important line is the "android:label" line. This line is for our Android application name will be seen on the phone. And if we change this label then our application name will also change on the phone. If you remember when we created a project we defined the application name is "My Android Project", but we see the "@string/app_name" here. This is because the "app_name" is a string expression and the string expressions are saved in the "string.xml" file in Android Studio. So, we can see the application name from the string file.

If we open the 'res' folder, then the 'values' folder and finally, the 'strings.xml' file from the project directory, we can see that the application name is located there. You can change the application name at any time right in here, and we're going to examine the "strings.xml" file here in our next lesson though. So, also check this out. All of our activity files are defined in the Manifest file. We have just one activity for this project. And you see it as defined in the Manifest file in the activity line as ".MainActivity". So, it's defined as a "LAUNCHER" activity in the category line. If we create new activities and want one of these activities, "LAUNCHER" activity, well should determine it as a "LAUNCHER" activity in the Manifest File. "LAUNCHER" activity will launch first when we open the application on the phone.

Now, there is another important thing that I need to tell you about when you're talking about the Android Manifest File, and that is user permissions. So when you develop an Android application, it's going to use some of the device features. Such as a camera, the Wi-Fi, phone numbers, microphone, location, you know that kind of thing. Now, you cannot reach those features without the user's permission. So, first you've got to get permission from the user. So, you'll be able to take these permissions in the Manifest File. Which permission do you want to take from the user, well, you'll write that in the Manifest File. So, we do the request for permission from the user as follows. Right above the application tag, we press the "<" key on the keyboard and open a new tag. Then we write user's permission. Here, you can select the 'users-permission'. Now, this is the option that suggested by the code editor, works just great. So, then after selecting this all the permissions you can get are listed all right here.

So, you can see in here which permission you can take from the users, such as access Wi-Fi state. So, this permission gives you access to the device Wi-Fi connection. Now, if you take network state permission, your application can use devices, mobile, internet. For example, if your application makes a phone call, well you have to take a phone call permission. So, you can take all of these permissions from the Manifest File. And when you do get all these permissions in the Manifest File, the user will see these permissions before downloading the app from the Google Play Store. I also want to point out that in all xml files you can press the "/" key or the shift and "<" keys on the keyboard to close a tag you have opened. If you need to write some code and a tag you've opened. Well, that is if the tag will have a body, you should close the tag by pressing the shift and "<" key.

After tag you opened, isn't going to have a body. Well, it's going to be enough to just close the tag by pressing the "/" button. Another topic here is screen orientation for this level. So, when the user opens your app on the mobile device, your application will appear vertical or horizontal. So, you can specify this in the Manifest File. So when you go into the activity tag, if you write orientation and select the 'screenOrientation' option, you can see different options. If you choose a "screenOrientation" as 'portrait', your application will appear vertical. If you choose a "screenOrientation" 'landscape', it will appear horizontal.

So, you can also change your application activity theme in the Manifest File. So, I just mean by theme, is the top section of the activity. So, you see that this is my first application part and it's replaceable. So, you can change the text color, the background color. You can add an icon and a whole lot of things. Everything that I've been talking about, you can specify in the theme. You can create a new theme and after that you can change it on the Manifest File. Don't worry about that though. We're going to do some examples about these topics in the coming videos. This is just some quick information and you got it. So, I'm going to see you in the next video.

 

About the Author
Students
86
Courses
23
Learning Paths
1

Mehmet graduated from the Electrical & Electronics Engineering Department of the Turkish Military Academy in 2014 and then worked in the Turkish Armed Forces for four years. Later, he decided to become an instructor to share what he knew about programming with his students. He’s currently an Android instructor, is married, and has a daughter.

Covered Topics