Professional Documents
Culture Documents
QB Mod 1
QB Mod 1
QB Mod 1
The android project contains different types of app modules, source code files, and resource
files. We will explore all the folders and files in the android app.
1. Manifests
2. Java Folder
3. res (Resources) Folder
Drawable Folder
Layout Folder
menu
Mipmap Folder
Values Folder
4. Gradle Scripts
Manifests
The Android manifest file helps to declare the permissions that an app must have to access
data from other apps. The Android manifest file also specifies the app’s package name that
helps the Android SDK while building the app. The Android manifest file provides
information such as activities, services, broadcast receivers, and content providers of an
android application.
Java folder
The Java folder contains all the java and Kotlin source code (.java) files that we create
during the app development, including other Test files. If we create any new project using
Kotlin, by default the class file MainActivity.kt file will create automatically under the
package name
Resource (res) folder
The resource folder is the most important folder because it contains all the non-code
sources like images, XML layouts, and UI strings for our android application.
res/drawable folder
It contains the different types of images used for the development of the application. We
need to add all the images in a drawable folder for the application development.
res/layout folder
The layout folder contains all XML layout files which we used to define the user interface
of our application. It contains the activity_main.xml file.
res/menu
The XML file related to the design of the menu elements will be placed in this folder.
Using inflate object the menu design in this folder will be attached to UI component.
res/mipmap folder
This folder contains launcher.xml files to define icons that are used to show on the home
screen. It contains different density types of icons depending upon the size of the device
such as hdpi, mdpi, xhdpi.
res/values folder
Values folder contains a number of XML files like strings, dimensions, colors, and style
definitions. One of the most important files is the strings.xml file which contains the
resources.
These folders are available with respect to res folder by default. Based on requirement few
more folders will be added.
1. onCreate()
It is called when the activity is first created. This is where all the static work is done like
creating views, binding data to lists, etc. This method also provides a Bundle containing its
previous frozen state, if there was one.
2. onStart()
It is invoked when the activity is visible to the user. It is followed by onResume() if the
activity is invoked from the background. It is also invoked after onCreate() when the
activity is first started.
3. onRestart()
It is invoked after the activity has been stopped and prior to its starting stage and thus is
always followed by onStart() when any activity is revived from background to on-screen.
4. onResume()
It is invoked when the activity starts interacting with the user. At this point, the activity is
at the top of the activity stack, with a user interacting with it. Always followed by
onPause() when the activity goes into the background or is closed by the user.
5. onPause()
It is invoked when an activity is going into the background but has not yet been killed. It is
a counterpart to onResume(). When an activity is launched in front of another activity, this
callback will be invoked on the top activity (currently on screen). The activity, under the
active activity, will not be created until the active activity’s onPause() returns, so it is
recommended that heavy processing should not be done in this part.
6. onStop()
It is invoked when the activity is not visible to the user. It is followed by onRestart() when
the activity is revoked from the background, followed by onDestroy() when the activity is
closed or finished, and nothing when the activity remains on the background only.
Note: this method may never be called, in low memory situations where the system does
not have enough memory to keep the activity’s process running after its onPause() method
is called
7. onDestroy()
The final call received before the activity is destroyed. This can happen either because the
activity is finishing (when finish() is invoked) or because the system is temporarily
destroying this instance of the activity to save space.
4. Design a Login activity using Linear Layout (Same question can be asked using
relative layout also)