Android Assingment Unit 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

1>What do you mean by Android?

List out the Different Flavours of


Android.

• Android is a software package and linux based operating system for mobile devices such
as tablet computers and smartphones.
• It is developed by Google and later the OHA (Open Handset Alliance). Java language is
mainly used to write the android code even though other languages can be used.
• The goal of android project is to create a successful real-world product that improves the
mobile experience for end users.

 Different Flavours of Android

o Android 1.0
o Android 1.1
o Android 1.5 Cupcake
o Android 1.6 Donut
o Android 2.0 Eclair
o Android 2.2 Froyo
o Android 2.3 Gingerbread
o Android 3.0 Honeycomb
o Android 4.0 Ice Cream Sandwich
o Android 4.1 Jelly Bean
o Android 4.4 KitKat
o Android 5.0 Lollipop
o Android 6.0 Marshmallow
o Android 7.0 Nougat
o Android 8.0 Oreo
o Android 9 Pie
o Android 10
o Android 11
o Android 12
o
o
o
o
o
o
o
o
o

1> Explain Android Architecture with proper Figure.


Android’s architecture encourages the concept of component reuse, enabling you to publish
and share Activities, Services, and data with other applications, with access managed by the
security restrictions you put in place.
The same mechanism that lets you produce a replacement contact manager or phone
dialer can let you expose your application components to let other developers create new
UI front ends and functionality extensions, or otherwise build on

Android Architecture or Android Software Stack is Categorized Into


five parts:-1.Linux kernel,2.Libararies,3.Android
4.Runtime,5.Application,6.Framework,7.Application Layer

➤ Linux kernel
l Core services (including hardware drivers, process and memory management, security,
network, and power management) are handled by a Linux 2.6 kernel. The kernel also
provides an abstraction layer between the hardware and the remainder of the stack.

Libraries
Running on top of the kernel, Android includes various C/C++ core libraries such as libc
and SSL, as well as:

➤ A media library for playback of audio and video media

➤ A surface manager to provide display management

➤ Graphics libraries that include SGL and OpenGL for 2D and 3D graphics

➤ SQLite for native database support

➤ SSL and WebKit for integrated web browser and Internet security

➤ Android run time


What makes an Android phone an Android phone rather than a mobile Linux
implementation is the Android run time. Including the core libraries and the Dalvik
virtual machine, the Android run time is the engine that powers your applications and,
along with the libraries, forms the basis for the application framework.

➤ Core libraries While Android development is done in Java, Dalvik is not a Java VM.
The core Android libraries provide most of the functionality available in the core Java
libraries as well as the Android-specific libraries.

➤ Dalvik virtual machine Dalvik is a register-based virtual machine that’s been


optimized to ensure that a device can run multiple instances efficiently. It relies on the
Linux kernel for threading and low-level memory management.

➤ Application framework:- The application framework provides the classes used to


create Android applications. It also provides a generic abstraction for hardware access and
manages the user interface and application resources.

➤ Application layer
All applications, both native and third-party, are built on the application layer by means
of the same API libraries. The application layer runs within the Android run time, using
the classes and services made available from the application framework.

2> Explain Activity Lifecycle with proper figure.


As a user nagates through the app, activity instance in your app
transitions through different stages in their lifestyle

Now let’s know the Android Activity Lifecycle in a more detailed


Manner with the help of life cycle methods and callbacks

Life Cycle Methods And Callbacks:-


1> OnCreat()
2> OnStart()
3> OnResume()
4> OnPause()
5> OnStop()
6> OnRestart()
7> OnDestroy()

1. onCreate():

 In this state, the activity is created.

2. onStart():
 This callback method is called when the activity becomes visible to the
user.

3. onResume():

 The activity is in the foreground and the user can interact with it.

4. onPause():

 Activity is partially obscured by another activity. Another activity that’s


in the foreground is semi-transparent.

5. onStop():

 The activity is completely hidden and not visible to the user.


6. onRestart():

 From the Stopped state, the activity either comes back to interact with
the user or the activity is finished running and goes away. If the activity
comes back, the system invokes OnRestart()
7. onDestroy(): 

Activity is destroyed and removed from the memory.

So these are the various methods of the Activity Life Cycle. Now let’s see
the situations where the life cycle methods and states will occur.

3> Write steps for creating new android project

1. Install the latest version of Android Studio.


2. In the Welcome to Android Studio window, click Create New
Project.
3. In the Select a Project Template window, select Empty Activity and
click Next.
4. In the Configure your project window, complete the following:
1. Enter "My First App" in the Name field.
2. Enter "com.example.myfirstapp" in the Package name field.
3. If you'd like to place the project in a different folder, change
its Save location.
4. Select either Java or Kotlin from the Language drop-down
menu.
5. Select the lowest version of Android you want your app to
support in the Minimum SDK field.

6. If your app will require legacy library support, mark the Use


legacy android.support libraries checkbox.
7. Leave the other options as they are.
5. Click Finish.
4> What do you mean by AVD? Steps to configure AVD.

An Android Virtual Device (AVD) is a device configuration that runs


on the Android Emulator. It provides virtual device-specific Android
Environment in which we can install & test our Android Application.
AVD Manager is a part of SDK Manager to create and manage the
virtual devices created.

Steps TO Configure AVD

1: Firstly, Select Tools > Android > AVD Manager > Click the AVD Manager icon in the
toolbar. Another way to open the AVD Manager directly by the AVD icon in the Tool bar.
2: Android Virtual Device Manager will be opened. After that Click on Create Virtual
Device.
3: After that choose the Category, phone size and choose the pixels according to your
requirement. After this click on Next button.
4: After that choose the SDK Version and Click on Next button. If you have various SDK
Versions like Kitkat, Lolipop and Marshmallow etc in your SDK then you can select one
of them. Here we have only Marshmallow SDK Version. So, we can go with the
Marshmallow SDK Version. Click on the next.
5: After that Enter the AVD Name in Android Virtual Device and Click on Finish button.
Here you can do customization to AVD which you are creating as per your requirement.
Click Finish and new AVD is created.
6: Now again open AVD manager and you will see your newely created AVD (Android
Virtual Device) is added in the list. Here click to Start the Virtual Device as shown in
figure below.
7: After that your AVD will start in Emulator. Now you can run your App in this AVD.
5> Explain Android SDK

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.

IT’s Components

1. Android SDK Tools


2. Android Build-Tools
3. Android Emulator
4. Android SDK Platform-tools
5. Android SDK Tools
6. SDK Platforms
7. SDK Update Sites
6> Explain Anatomy of an Android Application. –
Context, Activity, Services, Intents.

Classical computer science classes often define a program in


terms of functionality and data, and Android applications are no
different. They perform tasks, display information to the screen,
and act upon data from a variety of sources.
Developing Android applications for mobile devices with limited
resources requires a thorough understanding of the application
lifecycle. Android uses its own terminology for these application
building blocks—terms such as context, activity, and intent. This
chapter familiarizes you with the most important terms, and their
related Java class components, used by Android applications.

 CONTEXT

The context is the central command center for an Android


application. Most application-specific functionality can be
accessed or referenced through the context. The Context
class (android.content.Context) is a fundamental building
block of any Android application and provides access to
application-wide features such as the application’s private
files and device resources as well as system-wide services.
The application-wide Context object is instantiated as an
Application object (android.app.Application).
 Activity

An Android application is a collection of tasks, each of


which is called an activity. Each activity within an
application has a unique task or purpose. The Activity class
(android.app.Activity) is a fundamental building block of any
Android application, and most applications are made up of
several activities. Typically, this purpose is to handle the
display of a single screen, but only thinking in terms of “an
activity is a screen” is too simplistic. An Activity class
extends the Context class, so it also has all of the
functionality of the Context class.

 Intents

The Android operating system uses an asynchronous


messaging mechanism to match task requests with the
appropriate activity. Each request is packaged as an intent.
You can think of each such request as a message stating
an intent to do something. Using the Intent class
(android.content.Intent) is the primary method in which
application components such as activities and services
communicate with one another.

 Services

Tasks that do not require user interaction can be


encapsulated in a service. A service is most useful when
the operations are lengthy (offloading time-consuming
processing) or need to be done regularly (such as checking
a server for new mail). Whereas activities run in the
foreground and generally have a user interface, the Service
class (android.app.Service) is used to handle background
operations related to an Android application. The Service
class extends the context class.

7> How to manage Activity with Intent.

In the course of the lifetime of an Android application, the user


might transition between a number of different Activity instances. At
times, there might be multiple Activity instances on the activity stack.
Developers need to pay attention to the lifecycle of each Activity during
these transitions.
Some Activity instances—such as the application splash/startup
screen—are shown and then permanently discarded when the main
menu screen Activity takes over. The user cannot return to the splash
screen Activity without re-launching the application. In this case, use
the startActivity() and appropriate finish() methods.
Other Activity transitions are temporary, such as a child Activity
displaying a dialog and then returning to the original Activity (which
was paused on the activity stack and now resumes). In this case, the
parent Activity launches the child Activity and expects a result. For this,
use the startActivityForResult() and onActivityResult() methods.
8> What is the role of DVM in android? Explain it.

As we know the modern JVM is high performance and provides excellent memory
management. But it needs to be optimized for low-powered handheld devices as well.

The Dalvik Virtual Machine (DVM) is an android virtual machine optimized for mobile
devices. It optimizes the virtual machine for memory, battery life and performance.

Dalvik is a name of a town in Iceland. The Dalvik VM was written by Dan Bornstein.

The Dex compiler converts the class files into the .dex file that run on the Dalvik VM.
Multiple class files are converted into one dex file.

The javac tool compiles the java source file into the class file.

The dx tool takes all the class files of your application and generates a single .dex file. It
is a platform-specific tool.

The Android Assets Packaging Tool (aapt) handles the packaging process.

9> What is an emulator? Explain in brief.


The Android emulator is an Android Virtual Device (AVD), which
represents a specific Android device. We can use the Android emulator as a
target device to execute and test our Android application on our PC.

The Android emulator provides almost all the functionality of a real


device. We can get the incoming phone calls and text messages. It also
gives the location of the device and simulates different network speeds.

Android emulator simulates rotation and other hardware sensors. It


accesses the Google Play store, and much more
Testing Android applications on emulator are sometimes faster and easier than doing
on a real device. For example, we can transfer data faster to the emulator than to a real
device connected through USB.

The Android emulator comes with predefined configurations for several Android
phones, Wear OS, tablet, Android TV devices.

Requirement and recommendations

o SDK Tools 26.1.1 or higher

o 64-bit processor

o Windows: CPU with UG (unrestricted guest) support

o HAXM 6.2.1 or later (recommended HAXM 7.2.0 or later)

You might also like