Unit 1 Mad
Unit 1 Mad
UNIT-1
Basics of ANDROID Introduction to ANDROID
Android SDK stands for Android Software Development Kit which is developed by
Google for Android Platform. With the help of Android SDK, we can create android
Apps easily.
Android SDK is a collection of libraries and Software Development tools that are
essential for Developing Android Applications. Whenever Google releases a new
version or update of Android Software, a corresponding SDK also releases with it. In
the updated or new version of SDK, some more features are included which are not
present in the previous version. Android SDK consists of some tools which are very
essential for the development of Android Application. These tools provide a smooth
flow of the development process from developing and debugging. Android SDK is
compatible with all operating systems such as Windows, Linux, macOS, etc.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
• Android Emulator.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Android SDK build tools are used for building actual binaries of Android App. The
main functions of Android SDK Build tools are built, debug, run and test Android
applications. The latest version of the Android SDK Build tool is 30.0.3. While
downloading or updating Android in our System, one must ensure that its latest
version is download in SDK Components.
3. Android Emulator
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Thus, it simply means that without needing any physical device Android SDK
component "Android Emulator" provides a virtual device on the System where we run
our Application. The emulator's come with the configuration for Various android
phones, tablets, Wear OS, and Android TV devices.
In Android Virtual Emulator all functions that are feasible on real Android mobile is
works on virtual Device like:
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
• access on google play store and lot's more.
But there is one disadvantage of this emulator is that. It is very slow when System's PC
has less RAM. It works fine when a maximum GB of RAM is present on our device.
Android SDK Platform-tools is helpful when we are working on Project and they will
show the error messages at the same time. It is specifically used for testing. It includes:
• Systrace tools help to collect and inspect timing information. It is very crucial
for App Debugging.
Android SDK tool is a component of SDK tool. It consists of a set of tools which and
other Utilities which are crucial for the development of Android Application. It
contains the complete set of Debugging and Development tools for android.
6. SDK Platforms
For Each Android Software, one SDK platform is available as shown below:
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
These are numbered according to the android version. The new version of the SDK
platform has more features and more compatible but the old version is less compatible
with fewer features. Like in Android 11.0(R) have more compatible and have more
feature but the below versions like Android 10.0(Q), Android4.4(KitKat) have less
feature and is less compatible.
In SDK Update Sites, some sites are embedded in it which will check for Android
SDK Updates Tools. In this, one must ensure we don't unclick the button below
because these are checked by default which will check for updates if we will unclick it
then it doesn't check updates for those.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Feature Description
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Feature Description
7. Android Debug Bridge Allows developers to install, debug, and manage apps on
(ADB) an emulator or connected device.
10. Documentation & Offers guides, tutorials, and example projects to support
Samples developers.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Features of Android
Android is a powerful open-source operating system that open-source provides immense
features and some of these are listed below.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
android versions such as Apple Pie, Banana Bread, Cupcake, Donut, Éclair, Froyo,
Gingerbread, Jellybeans, Kitkat, Lollipop, marshmallow, Nougat, Oreo, etc. with extra
functionalities and new features.
The following table shows the version details of android which is released by Google
from 2007 to date.
Code Name Version API level Release date
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Code Name Version API level Release date
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Programming Languages used in Developing Android Applications
1. Java
2. Kotlin
Developing the Android Application using Kotlin is preferred by Google, as Kotlin is
made an official language for Android Development, which is developed and maintained
by JetBrains. Previously before Java is considered the official language for Android
Development. Kotlin is made official for Android Development in Google I/O 2017.
Advantages of Android Development
• The Android is an open-source Operating system and hence possesses a vast
community for support.
• The design of the Android Application has guidelines from Google, which
becomes easier for developers to produce more intuitive user applications.
• Fragmentation gives more power to Android Applications. This means the
application can run two activities on a single screen.
• Releasing the Android application in the Google play store is easier when it is
compared to other platforms.
Disadvantages of Android Development
• Fragmentation provides a very intuitive approach to user experience but it has
some drawbacks, where the development team needs time to adjust to the
various screen sizes of mobile smartphones that are now available in the
market and invoke the particular features in the application.
• The Android devices might vary broadly. So the testing of the application
becomes more difficult.
• As the development and testing consume more time, the cost of the application
may increase, depending on the application's complexity and features.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
specific functions. These embedded systems can work without human intervention or
with little human intervention.
Components of Embedded Systems
1. Hardware 2. Software 3. Firmware
Examples of Embedded Systems
• Digital watches
• Washing Machine
• Toys
• Televisions
• Digital phones
• Laser Printer
• Cameras
• Industrial machines
• Electronic Calculators
• Automobiles
• Medical Equipment
Application of Embedded System
• Home appliances
• Transportation
• Health care
• Business sector & offices
• Defense sector
• Aerospace
• Agricultural Sector
Characteristics of an Embedded System
• Performs specific task: Embedded systems perform some specific function or
tasks.
• Low Cost: The price of an embedded system is not so expensive.
• Time Specific: It performs the tasks within a certain time frame.
• Low Power: Embedded Systems don't require much power to operate.
• High Efficiency: The efficiency level of embedded systems is so high.
• Minimal User interface: These systems require less user interface and are
easy to use.
• Less Human intervention: Embedded systems require no human intervention
or very less human intervention.
• Highly Stable: Embedded systems do not change frequently mostly fixed
maintaining stability.
• High Reliability: Embedded systems are reliable they perform tasks
consistently well.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
• Use microprocessors or microcontrollers: Embedded systems
use microprocessors or microcontrollers to design and use limited memory.
• Manufacturable: The majority of embedded systems are compact and
affordable to manufacture. They are based on the size and low complexity of
the hardware.
Block Structure of Embedded System
Embedded System
Advantages of Embedded System
• Small size.
• Enhanced real-time performance.
• Easily customizable for a specific application.
Disadvantages of Embedded System
• High development cost.
• Time-consuming design process.
• As it is application-specific less market available.
Top Embedded Programming Languages: Some of the programming languages used
in the development of embedded systems include, Embedded C, Embedded C + +,
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Embedded Java, Embedded Python etc. But it completely rests on the developer which
programming language he selects for the development of the embedded systems.
How does an Embedded System Work?
Embedded systems operate from the combination of hardware and software that focuses
on certain operations. An embedded system at its heart has microcontroller or
microprocessor hardware on which user writes the code in form of software for control
of the system. Here is how it generally works:
• Hardware Layer: Some of the hardware elements that are incorporated in an
embedded system include the sensor, actuator, memory, current I/O interfaces
as well as power supply. These components are interfaced with the micro
controller or micro processor depending up on the input signals accepted.
• Input/Output (I/O) Interfaces: They to give the system input in form of data
from sensors or inputs made by the users and the microcontroller processes the
data received. The processed data is then utilized to coordinate the output
devices such as displays, motors or communication modules.
• Firmware: Firmware which is integrated within a system’s hardware
comprises of certain instructions to accomplish a task. Such software is often
used for real time processing and is tuned to work in the most optimal manner
on the system hardware.
• Processing: Depending on the given software and the input data received from
the system’s inputs the microcontroller calculates the appropriate output or
response and manages the system’s components.
• Real-time Operation: Some of the most common systems are real time, this
implies that they have the ability to process events or inputs at given time. This
real time capability makes sure that the system accomplishes its intended
function within stated time demands.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
There are multiple tools available for Android development. You must choose the
right tools for you to get started. This includes the preferred IDE, programming
language, and external tools. At first, you may find it difficult to get used to them; the
more you practice, the better you get at developing these applications.
What is Android Development?
Android development is generally the process of creating applications (apps) that run
on devices powered by the Android operating system, such as smartphones and tablets. It
typically involves writing code using programming languages like Java or Kotlin that
designs the user interface (UI) of the app and helps in integrating various features like
data storage, networking, and user interactions. Android developers use specialized tools
like Android Studio, which is an IDE provided by Google in order to build and test their
apps. Once an app is developed, it can be published on the Google Play Store for users
to download and use on their Android devices.
10 Best Android Development Tools in 2025
Here are the list of Best Android development tools that will help you in creating
robust and stable android applications. Let's begin...
1. Android Studio
Android Studio is by far the most important tool you need for Android
Development. It was created by both Google and JetBrains and it is very similar to
IntelliJ IDEA. Android Studio is a specific IDE used by Android developers. This can
also be used to develop cross-platform applications using Flutter.
Android Studio allows you to have multiple features relating to Android Development
like:
• Wireless Debugging: You can debug your applications on a physical device
wireless, provided you are on the same network.
• Preview: For Compose Applications, you can view the preview of the specific
component you are building.
• Sync with Android SDK: Android Studio has great synchronisation with your
system’s available SDK and provides flawless code intellisense.
• Built-in Gradle system: Android, being a JVM application, uses the Gradle
build system. The UI allows for an easier interface to run commands.
• Logcat: Your application does not work as intended. Debugging in Android is
done using the system’s Logcat, an inbuilt window inside Android Studio.
• Device Manager and Profiler: Building an Android application involves
analysing multiple application areas such as device usage, battery usage,
memory usage, and more.
2. Kotlin Programming Language
Android development first started using Java as their preferred language of development.
However, since JetBrains announced their stable release of Kotlin, we have had multiple
migrations from Java to Kotlin quickly. In May 2019, Google announced Kotlin to
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
be Android’s preferred language of development. Every new technology released
since then by Google has been written in Kotlin.
But what does Kotlin have to offer? Why are so many developers choosing Kotlin over
Java? Kotlin builds upon the foundation of improving the drawbacks of Java. It reduces
the verbose syntax and adds functionality that Java developers have complained about
for multiple years. Kotlin’s concise syntax and robustness was the primary reason for the
migration of Java developers to use Kotlin for development.
Hold on. What do we do about the legacy applications written in Java? Their technology
would be obsolete in the coming years. Thankfully, there is an easy fix for that. Kotlin is
100% interoperable with Java. In other words, Kotlin code can invoke and use Java
classes and functions, and the other way around. You can have both Kotlin and Java
code in the same codebase without any configuration costs. Old legacy code does not
need to be fully replaced with Kotlin.
3. Firebase
Firebase is perhaps one of the best tools to use if you are not familiar with
building backend API Servers, or you may be just too lazy to build one yourself.
Firebase is a Google-run backend service that is free to use until a certain limit. This
service includes databases, cloud storage, cloud functions, authentication, and more.
If you are creating an application that requires the user to be logged in, then why would
you create an entire Authentication system for that if you can simply press a few buttons
and write about 20 lines of code? Similarly with databases and cloud storage.
Other features that Firebase offers are Crashlytics, ML kit, and Hosting (for web
apps). One should check this tool if you are into any kind of mobile development (even
for websites).
4. Jetpack Compose
One of the best tools to be released by Google in the past years is Jetpack Compose. This
is a brand new UI toolkit written entirely in Kotlin for Kotlin developers. Shifting from
the old norm to having separate XML layouts and connecting them to the backend code,
Jetpack Compose is a declarative style UI toolkit where “Composable functions” are
drawn on the screen.
Jetpack Compose reduces much of the boilerplate code that was present in the old XML
layout way of creating UIs. It is state-driven and also 100% interoperable with Android
Views. Since its stable release, multiple users have shifted to this tool and I believe you
should too.
5. GitHub
This tool is a no-brainer to use regardless of the work you are doing. Imagine you have
some code that is working, but it breaks when you implement a feature. OH no! You
need to revert back to the previous stage when it was working, but you forgot the exact
code. Your entire code is now broken and you must start over. . . NO!
This is when you create zip files of your code every day. Again, NO! You should use a
Version Control System like Git and upload your code on a platform like GitHub. Your
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
code is saved by identity strings called “Commit Hashes” and GitHub is a cloud
platform that saves your code for others to see, like your friends, peers and recruiters.
They can contribute to the code you write and develop Android applications together.
6. Dagger Hilt
Dagger Hilt is a dependency injection library commonly used in the Android
Development community. This is an advanced technique that is popularly used in
architectures like MVVM (Model View ViewModel) and Clean Architecture.
Dependency Injection is a solution to the Dependency Inversion principle from SOLID
principles in Software Engineering Design. Let's say that you are using API X to get all
your data regarding Football! Everything works fine until, oh no API X is
decommissioned and no longer maintained. You need to use API Y now to get your
application working. However, your code didn’t use the dependency inversion principle
- i.e. you had coupled your application to use the components from API X only. You
have to change the entire application so that it is compatible with API X.
With Dagger Hilt and dependency inversion principles, you can replace the old
implementation of API X with the new implementation of API Y without making core
changes to your application. This way of structuring your code also allows for testing
individual components in isolation.
7. Coil
Coil is a brilliant library to use, especially with Kotlin and Jetpack Compose, to
load images from the internet. If your application uses many images, it may be a bad
idea to have the images bundled with your APK file (making the application big).
Instead, you can have your images stored somewhere on the cloud, and use the Coil
library to load the images when the user opens the application.
8. LeakCanary
LeakCanary is an open-source memory leak detection library to detect memory
leaks in your application. What are memory leaks, you ask? Memory leaks are portions
of memory that can no longer be accessed anymore. Let’s say you allocated some
memory to be used in the application. However, if the application is destroyed and you
did not properly clear out this memory, then this piece of memory stays in the system
forever. There is no longer a pointer to this chunk; hence, it cannot be destroyed.
Additionally, you cannot use the same chunk.
Memory leaks are deadly for your application. LeakCanary helps you identify when
there were any memory leaks and points you to the line of code that initiated the
memory leak. This is a tool important when building real applications for the store.
9. Jira
Oftentimes, you will be working in a team of developers. There would be ideas and bugs
popping up every minute of development that need to be dealt with. Post-covid, most
people don’t work at the same time and one cannot expect one person to fix all the bugs
they spot.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
JIRA is a great project management website that can be tailored to your needs and is
used to track issues, plan projects and promote team collaboration. JIRA supports Agile
development methodology and support features such as Agile Poker, Sprint cycles and
much more. This tool shines in streamlining the development process and improves team
communication.
10. Espresso
Last but not least, it is important to write tests for your application. JUnit and Mockito
are great JVM libraries to use to unit test and mock your code. Android development
requires UI Tests too to make sure that the UI is as intended. Espresso is the most
popular library for writing UI tests for your application. There are counterparts
available for testing Compose applications, which are evidently better and easier to work
with.
The manifest file also specifies the application metadata, which includes its icon,
version number, themes, etc., and additional top-level nodes can specify any required
permissions, and unit tests, and define hardware, screen, or platform requirements. The
manifest comprises a root manifest tag with a package attribute set to the project’s
package. It should also include an xmls:android attribute that will supply several
system attributes used within the file. We use the versionCode attribute is used to
define the current application version in the form of an integer that increments itself
with the iteration of the version due to update. Also, the versionName attribute is used
to specify a public version that will be displayed to the users.
We can also specify whether our app should install on an SD card of the internal
memory using the installLocation attribute. A typical manifest file looks as:
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.geeksforgeeks"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="preferExternal">
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="27" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication"
tools:targetApi="31">
<activity
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
android:name=".MainActivity"
android:exported="true">
<intent-filter>
</intent-filter>
</activity>
</application>
</manifest>
A manifest file includes the nodes that define the application components, security
settings, test classes, and requirements that make up the application. Some of the
manifest sub-node tags that are mainly used are:
1. manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.geeksforgeeks">
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
<!-- manifest nodes -->
<application>
</application>
</manifest>
2. uses-sdk
It is used to define a minimum and maximum SDK version by means of an API Level
integer that must be available on a device so that our application functions properly,
and the target SDK for which it has been designed using a combination of
minSdkVersion, maxSdkVersion, and targetSdkVersion attributes, respectively. It is
contained within the <manifest> element.
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="27" />
3. uses-permission
It outlines a system permission that must be granted by the user for the app to function
properly and is contained within the <manifest> element. When an application is
installed (on Android 5.1 and lower devices or Android 6.0 and higher), the user must
grant the application permissions.
<uses-permission
android:name="android.permission.CAMERA"
android:maxSdkVersion="18" />
4. application
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
A manifest can contain only one application node. It uses attributes to specify the
metadata for your application (including its title, icon, and theme). During
development, we should include a debuggable attribute set to true to enable debugging,
then be sure to disable it for your release builds. The application node also acts as a
container for the Activity, Service, Content Provider, and Broadcast Receiver nodes
that specify the application components. The name of our custom application class can
be specified using the android:name attribute.
<application
android:name=".GeeksForGeeks"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@drawable/gfgIcon"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@android:style/Theme.Light"
android:debuggable="true"
tools:targetApi="31">
</application>
5. uses-library
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
It defines a shared library against which the application must be linked. This element
instructs the system to add the library's code to the package's class loader. It is
contained within the <application> element.
<uses-library
android:name="android.test.runner"
android:required="true" />
6. activity
<activity
android:name=".MainActivity"
android:exported="true">
</activity>
7. intent-filter
It is the sub-element of activity that specifies the type of intent to which the activity,
service, or broadcast receiver can send a response. It allows the component to receive
intents of a certain type while filtering out those that are not useful for the component.
The intent filter must contain at least one <action> element.
<intent-filter>
</intent-filter>
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
8. action
It adds an action for the intent-filter. It is contained within the <intent-filter> element.
9. category
10. uses-configuration
<uses-configuration
android:reqTouchScreen=”finger”
android:reqNavigation=”trackball”
android:reqHardKeyboard=”true”
android:reqKeyboardType=”qwerty”/>
<uses-configuration
android:reqTouchScreen=”finger”
android:reqNavigation=”trackball”
android:reqHardKeyboard=”true”
android:reqKeyboardType=”twelvekey”/>
11. uses-features
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
It is used to specify which hardware features your application requires. This will
prevent our application from being installed on a device that does not include a
required piece of hardware such as NFC hardware, as follows:
12. permission
<permission
android: name=”com.paad.DETONATE_DEVICE”
android:protectionLevel=“dangerous”
android:label=”Self Destruct”
android:description=”@string/detonate_description”>
</permission>
• If you think about it, certain application changes should not really require a
recompile:
• Thus, an easy mechanism for keeping these resources apart from the code, so that
they can be changed easily, is extremely useful — and Java has one.
What “Resources”
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
• The idea behind a “resource” is that it is a distinct information package, separate from
the source code, but which the source code expects to be available
• The source code accesses this resource through some uniform interface that retrieves
the information needed by the application
• The interface should also provide for transparent swapping of resources — for
example, switching from English to Spanish labels — without changing any of the
source code (say, as a user preference)
Resources in Java:
java.util.ResourceBundle
• ResourceBundle works like a map or dictionary: given a key string, it will return a
string or object that has been mapped to that key
• ResourceBundle “automagically” finds the appropriate file containing the strings that
you want, based on its name and its location on the classpath
Internationalization in Java:
java.util.Locale
• A part of ResourceBundle’s algorithm for determining the resource file to use is the
Locale to use
• A Locale is Java’s abstraction for the information that varies based on the user’s
geographical, political, or cultural region: specifically, a Locale holds a country and a
language, both represented in accordance with ISO standards (see the Locale Javadoc
API for details)
• The Java virtual machine sets up the default Locale automatically; customization can
be done by modifying the user.language and user.country system properties
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Getting “Externalized”
• To achieve externalization (and thus, i18n) in Java, start by making some external
preparations: Prepare the resource properties file(s) — these are simple key-value text
files consisting multiple lines with the format key=value Arrange for the file(s) to be in
your app’s classpath
• Externalized strings don’t have to be visible labels: they can be strings for anything,
so this mechanism is potentially useful for anything else in your application that may
vary based on the country or language
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
activity stacks. So when a new activity starts, the previous one always
remains below it. There are four stages of an activity.
1. If an activity is in the foreground of the screen i.e at the top of the
stack, then it is said to be active or running. This is usually the activity
that the user is currently interacting with.
2. If an activity has lost focus and a non-full-sized or transparent activity
has focused on top of your activity. In such a case either another
activity has a higher position in multi-window mode or the activity
itself is not focusable in the current window mode. Such activity is
completely alive.
3. If an activity is completely hidden by another activity, it is stopped or
hidden. It still retains all the information, and as its window is hidden
thus it will often be killed by the system when memory is needed
elsewhere.
4. The system can destroy the activity from memory by either asking it to
finish or simply killing its process. When it is displayed again to the
user, it must be completely restarted and restored to its previous state.
For each stage, android provides us with a set of 7 methods that have their
own significance for each stage in the life cycle. The image shows a path of
migration whenever an app switches from one state to another.
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Example:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
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.
Example:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Toast toast = Toast.makeText(getApplicationContext(), "onCreate
Called", Toast.LENGTH_LONG).show();
}
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
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.
Example:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import com.example.share.R;
@Override
protected void onCreate(Bundle savedInstanceState) {
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
setContentView(R.layout.activity_main);
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Toast toast = Toast.makeText(getApplicationContext(), "onPause
Called", Toast.LENGTH_LONG).show();
}
}
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 that 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.
Example:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
super.onCreate(savedInstanceState);
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Example:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
protected void onDestroy() {
// It will show a message on the screen
// then onDestroy is invoked
Toast toast = Toast.makeText(getApplicationContext(), "onDestroy
Called", Toast.LENGTH_LONG).show();
}
}
Demo Android App to Demonstrate Activity Lifecycle in Android
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast toast = Toast.makeText(getApplicationContext(), "onCreate
Called", Toast.LENGTH_LONG).show();
}
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
@Override
protected void onRestart() {
super.onRestart();
Toast toast = Toast.makeText(getApplicationContext(), "onRestart
Called", Toast.LENGTH_LONG).show();
}
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Toast toast = Toast.makeText(getApplicationContext(), "onResume
Called", Toast.LENGTH_LONG).show();
}
Activity-Lifecycle-in-Android-Demo-App.mp4
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
TOPIC: ANDROID activities
Android Studio is the official IDE (Integrated Development Environment) for
Android application development and it is based on JetBrains' IntelliJ IDEA software.
Android Studio provides many excellent features that enhance productivity when
building Android apps, such as:
• A flexible Gradle-based build system
• A fast and feature-rich emulator
• A blended environment where one can develop for all Android devices
• Apply Changes to push code and resource changes to the running app without
restarting the app
• GitHub and Code template integration to assist you to develop common app
features and import sample code
• Extensive testing tools and frameworks
• C++ and NDK support
• Built-in support for Google Cloud Platform, making it easy to integrate Google
Cloud Messaging and App Engine and many more.
Generally, when a developer wants to create a new project in the android studio he/she
needs to select a project template which is consisting of many activities as shown in the
below image. (Considering that the developer developing the android app for phone and
tablet). So in this article, we are going to discuss what do these activities mean in brief.
Here is the list of activities:
1. No Activity
2. Basic Activity
3. Bottom Navigation Activity
4. Empty Activity
5. Fullscreen Activity
6. Google Admob Ads Activity
7. Google Maps Activity
8. Login Activity
9. Master/Detail Flow
10. Navigation Drawer Activity
11. Settings Activity
12. Scrolling Activity
13. Tabbed Activity
14. Fragment + ViewModel
15. Native C++
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
(1) No Activity
As the name suggests No Activity means creating a new empty project. When the
developer selects this activity there will be neither an XML file nor a Java/Kotlin file.
No files are automatically generated when you select No Activity. The project structure
will look like the following:
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
(3) Bottom Navigation Activity
Bottom Navigation Activity creates a new activity with bottom navigations. We all have
come across apps that contain a Bottom Navigation Bar. Some popular examples
include Instagram, WhatsApp, etc. These files are automatically created when you
select Bottom Navigation Activity and the following is the welcome page:
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
(6) Google Admob Ads Activity
To earn money from the Android app or game, there are many ways such as in-App
Purchases, Sponsorship, Advertisements, and many more. But there is another popular
method to earn money from the Android app is by integrating an advertisement e.g
known as Google AdMob. Google AdMob is designed with developers in mind, AdMob
helps to earn more app revenue, deliver better user experience, and surface actionable
insights all with automated tools that do the hard work for you. There are mainly four
types of flexible, high-performing format available in Google AdMob
• Native: Ads that you design to fit the app, seamlessly
• Interstitial: Full-screen ads that capture attention and become part of the
experience.
• Banner: Traditional formats in a variety of placements.
• Rewarded Video: An immersive, user-initiated video ad that rewards users for
watching.
In Android Studio Google Admob Ads Activity creates an activity with AdMob Ad
fragment. These files are automatically created when you select Google Admob Ads
Activity and the following is the welcome page:
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Master/Detail Flow creates a new master/detail flow, enabling users to view a collection
of objects as well as details for each object. This flow is presented using two columns on
tablet-sized screens and one column on handsets and smaller screens. This template
creates two activities, a master fragment, and a detailed fragment. These files are
automatically created when you select Master/Detail Flow and the following is the
welcome page:
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
files are automatically created when you select Scrolling activity and the following is the
welcome page:
Tabbed Activity creates a new blank activity with tabs. These files are automatically
created when you select Tabbed Activity and the following is the welcome page:
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology
MCA, 3rd Semester Subject Name: Mobile Application Development Subject Code: MC03094031
UNIT-1
Prepared BY: Prof. Hiral Hingu Shree Swaminarayan Gadi Institute of Technology