CS Answer

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

CS - Android

a) Types of Popular Mobile Operating System

 Android OS
 Blackberry OS
 Apple iOS
 Windows Mobile Operating System
 Symbian OS

b) Which virtual Machine is used by android


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.

c) Android is an open source operating system for mobile devices and a


corresponding open source project led by Google.

d) Android uses the action ACTION_SEND to send data from one activity to
another, even across process boundaries. You need to specify the data and its
type. The system automatically identifies the compatible activities that can receive
the data and displays them to the user.

e) Android 1.0 (2008)The first-ever Android operating system was released on


September 23, 2008 with the HTC Dream.

f) Encapsulation is a way to restrict the direct access to some components of an


object, so users cannot access state values for all of the variables of a particular
object. Encapsulation can be used to hide both data members and data functions
or methods associated with an instantiated class or object.

g) It defines the user interface for the main activity of an application. The file is
written in XML and includes elements like buttons, text views, image views, etc.
Each element in the XML is translated into Java classes at runtime.

h) SQLite is an embedded, server-less relational database management system. It


is an in-memory open-source library with zero configuration and does not require
any installation. Also, it is very convenient as it's less than 500kb in size, which is
significantly lesser than other database management systems.

i) Views represent the UI elements like buttons, text fields, and images, while
ViewGroups act as containers for organizing and arranging these Views.

j) Using Android Virtual Device and Android Physical Device


k) A thread is a thread of execution in a program. The Java Virtual Machine allows
an application to have multiple threads of execution running concurrently. Every
thread has a priority. Threads with higher priority are executed in preference to
threads with lower priority.

l) Extensible Markup Language (XML) is a markup language that provides rules to


define any data. Unlike other programming languages, XML cannot perform
computing operations by itself.

Section B

a) An Android Virtual Device (AVD) is a configuration that defines the


characteristics of an Android phone, tablet, Wear OS, Android TV, or Automotive
OS device that you want to simulate in the Android Emulator. The Device Manager
is a tool you can launch from Android Studio that helps you create and manage
AVDs.

AVDs provide a way to test applications on different versions of Android, different


screen sizes, and different hardware configurations, making it easier to identify
and resolve compatibility issues.

b) The application framework offers services that we may use to construct


applications in accordance with our needs, such as telephony service, location
services, notification management, NFC service, view system, etc. Through Java-
written APIs, the whole feature set of the Android OS is accessible to developers.

c) The DVM is a virtual machine to run Android applications. The DVM executes
Dalvik bytecode, which is compiled from programs written in the Java language.
Note that the DVM is not a JVM. One of the key design principles of the DVM is
that it should run on low memory mobile devices and loads quicker compared to
any JVM.

d) A simulator creates an environment that mimics the behaviors, variables, and


configurations in the production environment of an iOS app. An emulator mimics
all the hardware and software features for the Android app production environment
of a real device.

e) The Android Manifest is an XML file which contains important metadata about
the Android app. This includes the package name, activity names, main activity
(the entry point to the app), Android version support, hardware features support,
permissions, and other configurations.
f) Android software development is the process by which applications are created
for devices running the Android operating system. Google states that "Android
apps can be written using Kotlin, Java, and C++ languages" using the Android
software development kit (SDK)

g) A ViewGroup is a special view that can contain other views. The ViewGroup is
the base class for Layouts in android, like LinearLayout , RelativeLayout ,
FrameLayout etc. In other words, ViewGroup is generally used to define the layout
in which views(widgets) will be set/arranged/listed on the android screen.
h) In Android, whenever we want to bind some data which we get from any data
source (e.g. ArrayList, HashMap, SQLite, etc.) with a UI component(e.g. ListView,
GridView, etc.) then Adapter comes into the picture. Basically Adapter acts as a
bridge between the UI component and data sources.
i) A drawable folder is nothing but a resource directory in Android studio source
code of your project. This folder holds images, png which are referenced in code
via R.drawable.xyz.
Section C
a) Difference between Windows and Android are as follows:

WINDOWS ANDROID

It was developed and is owned by Microsoft It was developed and is owned by Google
Incorporation. LLC.

It was launched in 1985. It was launched in 2008.

It is specifically designed for mobile


It is designed for PC of all companies.
devices.

Current stable version is Windows 11. Current stable version is Android 13.

Kernel type is Hybrid with modules here. Kernel type is Linux-based.

It is free of cost as it is inbuilt is


It charges for the original version.
smartphones.

It is the most used operating system


It is the most used operating system in personal computers.
overall.

It is for workstation, personal computers, media center, Its target system type is smartphones and
tablets and embedded systems. tablet computers.
b) The class file i.e the byte code for Android is first optimized even more to make
it mobile friendly, Which usually has a custom format according to specifications of
Dalvik VM, which differs from normal bytecode. Hence direct JAVA bytecode
wont't run in Android.
c) In a single thread or threading, the process contains only one thread. That
thread executes all the tasks related to the process. In a multi-threaded
application, multiple threads are executed concurrently. Each thread handles
different tasks simultaneously by making optimal use of the resources. In Java,
there are two methods to create threads. These are by implementing a Runnable
interface or extending the Thread class.

d) Android Activity Lifecycle is controlled by 7 methods of android.app.Activity


class. The android Activity is the subclass of ContextThemeWrapper class. An
activity is the single screen in android. It is like window or frame of Java. By the
help of activity, you can place all your UI components or widgets in a single
screen. The 7 lifecycle method of Activity describes how activity will behave at
different states.

onCreate called when activity is first created.

onStart called when activity is becoming visible to the user.

onResume called when activity will start interacting with the user.

onPause called when activity is not visible to the user.

onStop called when activity is no longer visible to the user.

onRestart called after your activity is stopped, prior to start.

onDestroy called before the activity is destroyed.

e) Open Source, Larger Developer and Community Reach, Increased Marketing,


Inter Application Integration, Reduced Cost of Development, Higher Success
Ratio, Rich Development Environment

f) An android component is simply a piece of code that has a well defined life
cycle e.g. Activity, Receiver, Service etc. The core building blocks or fundamental
components of android are activities, views, intents, services, content providers,
fragments and AndroidManifest.xml.

g) Steps to be written
h) A layout defines the structure for a user interface in your app, such as in an
activity. All elements in the layout are built using a hierarchy of View and
ViewGroup objects. A View usually draws something the user can see and interact
with.
 Android Linear Layout: LinearLayout is a ViewGroup subclass, used to provide child View
elements one by one either in a particular direction either horizontally or vertically based on the
orientation property.
 Android Constraint Layout: ConstraintLayout is a ViewGroup subclass, used to specify the
position of layout constraints for every child View relative to other views present. A
ConstraintLayout is similar to a RelativeLayout, but having more power.
 Android Grid View: GridView is a ViewGroup that is used to display a scrollable list of items in a
grid view of rows and columns.
i) Intent intent = new Intent(getApplicationContext(), Second_activity.class);
intent.putExtra("message_key", str);
startActivity(intent);

j) The View class is the base class or we can say that it is the superclass for all the GUI
components in android. For example, the EditText class is used to accept the input from
users in android apps, which is a subclass of View. View refer to
the android.view.View class, which is the base class of all UI classes.
The ViewGroup class is a subclass of the View class. And also it will act as a base class
for layouts and layouts parameters. The ViewGroup will provide an invisible container to
hold other Views or ViewGroups and to define the layout properties. For example, Linear
Layout is the ViewGroup that contains UI controls like Button, TextView, etc., and other
layouts also.

You might also like