answers
answers
2 Marks Questions:
2. What is OHA?
OHA stands for Open Handset Alliance. It is a group of hardware, software, and
telecommunication companies that collaborate to develop open mobile standards and
improve the Android platform. Google leads the OHA, and members include companies like
Samsung, HTC, Sony, and Qualcomm. The goal of OHA is to promote innovation and
standardization in mobile technology.
4 Marks Questions:
The Android ecosystem consists of various components that work together to create a robust
platform:
Android's ecosystem is vast, including manufacturers like Samsung, OnePlus, and Google,
along with various mobile networks and software companies.
1. Linux Kernel
o The core layer that interacts with hardware.
o Manages memory, processes, security, and drivers (camera, Wi-Fi, audio).
2. Hardware Abstraction Layer (HAL)
o Provides an interface between hardware components and the Android OS.
3. Native Libraries
o Includes essential libraries like SQLite (database), WebKit (browser),
OpenGL (graphics), and Media Framework.
4. Android Runtime (ART)
o Replaces Dalvik Virtual Machine (DVM).
o Uses Just-In-Time (JIT) and Ahead-Of-Time (AOT) compilation for efficient
performance.
5. Application Framework
o Manages UI, resources, locations, and notifications.
o Includes key components like Activity Manager, Content Providers, and
Broadcast Receivers.
6. Applications Layer
o The top layer where apps run, including system apps like Contacts, Messages,
and third-party apps.
Chapter 2 – INSTALLATION & CONFIGURATION OF ANDROID
2 Marks Questions:
1. What is SDK?
2. What is Emulator?
An Android Emulator is a virtual device that simulates real Android hardware and software
on a computer. It allows developers to test applications without needing a physical device.
The emulator supports various screen sizes, resolutions, and Android versions.
3. What is ADT?
ADT (Android Development Tools) was an Eclipse-based plugin that provided tools for
developing Android applications. It included:
Since 2015, Android Studio has replaced ADT as the official development environment.
4 Marks Questions:
DVM (Dalvik Virtual Machine) is a register-based virtual machine designed for Android.
It converts Java bytecode into Dalvik Executable (.dex) format, which is optimized for
memory efficiency and performance.
DVM Architecture:
Since Android 5.0 (Lollipop), ART (Android Runtime) replaced DVM for better
performance and battery efficiency.
Android SDK is a set of development tools provided by Google for building Android apps.
It includes:
An AVD (Android Virtual Device) is used for testing apps. Steps to create one:
2 Marks Questions:
FrameLayout is used to hold a single view or stack multiple views. Important attributes:
4 Marks Questions:
1. What is the use of the AndroidManifest.xml file in an Android application?
Example:
xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
The MainActivity.java or MainActivity.kt file contains the main logic of the app.
It extends AppCompatActivity and loads the UI using
setContentView(R.layout.activity_main).
Example:
java
xml
<resources>
<string name="app_name">MyApplication</string>
</resources>
xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
3. What are View and ViewGroup Classes in Android? Why are Layouts
Created Using XML?
View Class:
View is the base class for all UI elements like Buttons, TextViews, EditTexts, etc.
ViewGroup Class:
The res (Resources) folder in an Android project contains various subfolders for app
resources:
Folder Purpose
res/drawable/ Stores images, icons, and XML drawables.
res/layout/ Contains XML files defining the UI structure.
res/mipmap/ Stores app launcher icons (optimized for different resolutions).
Contains XML files like strings.xml, colors.xml, dimens.xml, and
res/values/
styles.xml.
res/raw/ Stores raw files like audio, text, and JSON.
res/menu/ Stores XML files defining navigation menus.
res/xml/ Stores custom XML configurations.
Example of values/colors.xml:
xml
<resources>
<color name="primaryColor">#6200EE</color>
<color name="accentColor">#03DAC5</color>
</resources>
2 Marks Questions:
wrap_content
o The view takes only as much space as required to fit its content.
o Example:
xml
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
xml
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Click Me" />
o The Button will stretch to match the full width of the parent.
4 Marks Question:
TextView
xml
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome to Android" />
EditText
xml
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter your name" />
TextView Attributes
xml
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, Android!"
android:textSize="18sp"
android:textColor="#FF0000"
android:textStyle="bold"
android:gravity="center"
android:maxLines="2"
android:ellipsize="end" />