Predict
Predict
An Intent in Android is used to start a new activity, send data between activities, or
request an action from another app or component, such as opening the camera, browser,
or dialer. It acts as a messaging object for communication between components.
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Gender:"
android:textSize="18sp"
android:layout_marginBottom="16dp" />
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/radioMale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male" />
<RadioButton
android:id="@+id/radioFemale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female" />
</RadioGroup>
<Button
android:id="@+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:layout_marginTop="24dp" />
</LinearLayout>
B. requestLocationUpdates()
Continuously gets updated location at intervals.
fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback,
Looper.getMainLooper());
C. getLatitude() / getLongitude()
Extracts latitude and longitude from a Location object.
double lat = location.getLatitude();
double lon = location.getLongitude();
D. Geocoder.getFromLocation()
Converts latitude and longitude to a readable address.
Geocoder geo = new Geocoder(this);
List<Address> list = geo.getFromLocation(lat, lon, 1);
String address = list.get(0).getAddressLine(0)
7. DVM vs JVM
Feature Dalvik Virtual Machine (DVM) Java Virtual Machine (JVM)
Architecture Register-based architecture Stack-based architecture
Bytecode Dalvik Executable (DEX) files Standard Java bytecode files
Format
Optimization Optimized for low memory usage Optimized for general-purpose
on mobile devices computing (desktops, servers)
Multi-core Limited multi-core support Better support for multi-core
Support processors
• After installation, open Android Studio and select Do not import settings.
10. Explain how frame and linear layout used to design an android application with
suitable example
FrameLayout
FrameLayout is a simple layout in Android used to display a single view or to stack multiple
views on top of each other. It places all child views at the top-left corner by default.
FrameLayout is useful for creating overlapping views, such as displaying a TextView on top
of an ImageView. It is also commonly used as a container for fragments. Some key attributes
of FrameLayout include:
1. android:layout_width – sets the width of the layout,
2. android:layout_height – sets the height of the layout,
3. android:foreground – sets a drawable that appears on top of the content,
4. android:layout_gravity – controls the alignment of child views inside the frame.
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/background" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome"
android:textSize="24sp"
android:layout_gravity="center" />
</FrameLayout>
LinearLayout
LinearLayout is a layout in Android that arranges its child elements either vertically or
horizontally in a single direction. It is simple and ideal for creating clean, structured layouts
like forms or button groups. The orientation is controlled using the android:orientation
attribute. Some key attributes of LinearLayout include:
1. android:orientation – sets the layout direction (vertical or horizontal),
2. android:layout_weight – distributes space among child views,
3. android:gravity – aligns child elements within the layout,
4. android:layout_gravity – aligns the view within its parent layout.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter username" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login" />
</LinearLayout>
11. Four Student Data Insertion Program
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TableLayout
android:id="@+id/studentTable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*"
android:background="#E0E0E0">
MainActivity.java
package com.example.studenttable;
import android.os.Bundle;
import android.widget.*;
import androidx.appcompat.app.AppCompatActivity;
String[][] students = {
{"1", "Rahul", "Android", "85"},
{"2", "Sneha", "Java", "90"},
{"3", "Amit", "Python", "88"},
{"4", "Priya", "Web Dev", "92"}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
The Developer Console (now known as Google Play Console) is a crucial tool for
Android app developers. It is a web-based platform provided by Google that allows
developers to publish, manage, monitor, and monetize their Android applications on the
Google Play Store.
Android architecture is the structure or layers that make up the Android Operating
System. It is divided into four main layers, and each layer has specific functions that help
the system and apps work properly.
1.Linux Kernel (Bottom Layer)
➢ Display Driver
➢ Camera Driver
➢ WiFi Driver
➢ Audio Driver
➢ Power Manager
➢ Keypad Driver
➢ Flash Memory Driver
➢ IPC (Inter-Process Communication) Driver
A) Libraries
B) Android Runtime