Skip to main

AK#Notes


Sponsored by drift/net (WIP)


Android

1. Attempt any FIVE of the following: 10

a) List any four features of Android operating system.

b) Define Dalvik Virtual Machine (DVM).

JVM DVM
JVM supports multiple OS DVM supports only Android Operating system.
JVM forms separate classes in separate .class byte code files. DVM forms multiple class in .dex byte code file.
It is based on stack based virtual machine architecture. It is based on register based virtual machine architecture.
JVM runs on more memory DVM runs on less memory.
The executable format of JVM is JAR. The executable format of DVM is APK.
JVM has different constant pools. DVM has common constant pool.
It runs .class byte code directly. The .class byte codes are optimize to .odex format before executing in DVM.

c) List any four folders from directory structure of Android project and elaborate in one line.

Manifests Folder

d) List any four attributes of check box.

f) State syntax to display built in zoom control.

In Android, Zoom Control is a class that has some set of methods that are used to control the zoom functionality.

.java
ZoomControl zoomControls = (ZoomControls) findViewById(R.id.simpleZoomControl);

g) Name two classes used to play audio and video in Android.

2. Attempt any THREE of the following: 12

a) Describe Android architecture with diagram.

b) Differentiate between DVM and JVM

JVM DVM
JVM supports multiple OS DVM supports only Android Operating system.
JVM forms separate classes in separate .class byte code files. DVM forms multiple class in .dex byte code file.
It is based on stack based virtual machine architecture. It is based on register based virtual machine architecture.
JVM runs on more memory DVM runs on less memory.
The executable format of JVM is JAR. The executable format of DVM is APK.
JVM has different constant pools. DVM has common constant pool.
It runs .class byte code directly. The .class byte codes are optimize to .odex format before executing in DVM.

c) List and elaborate steps to deploy in Android application on Google play store.

d) Describe with example, how to create a simple database in SQLite (Assume suitable data).

3. Attempt any THREE of the following: 12

a) Write down the steps to install and configure Android studio.

b) State syntax to create Text View and Image button with any two attributes of each.

TextView

.xml
<TextView
    android:id="@+id/student_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Name:" />

ImageButton

.xml
<ImageButton
  android:id="@+id/imageButton"
  android:src="@drawable/button"
  android:layout_height="wrap_content"
  android:layout_width="wrap_content"/>

c) Describe Android service life cycle along with diagram.

d) State and elaborate the syntax of required class and methods for Geocoding.

4. Attempt any THREE of the following: 12

a) Explain with example, code to create GUI using absolute layout (Assume suitable data).

.xml
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="16dp"
    android:paddingTop="16dp"
    android:paddingRight="16dp"
    tools:context=".MainActivity">
    <TextView
        android:id="@+id/student_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="125dp"
        android:layout_y="280dp"
        android:text="Name:"
        android:textColor="#86AD33"
        android:textSize="20dp"
        android:textStyle="bold" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="125dp"
        android:layout_y="304dp"
        android:text="Age:"
        android:textColor="#86AD33"
        android:textSize="20dp"
        android:textStyle="bold" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="125dp"
        android:layout_y="328dp"
        android:text="Mobile Number:"
        android:textColor="#86AD33"
        android:textSize="20dp"
        android:textStyle="bold" />
</AbsoluteLayout>

b) Write a program to demonstrate Date and Time picker.

Date Picker

TimePicker

c) Describe multimedia framework of Android with diagram.

Multimedia framework of Android diagram

d) Discuss developer console with at least four features.

e) Write a program to demonstrate declaring and using permissions with any relevant example.

AndroidManifest.xml

.xml
<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="org.geeksforgeeks.requestPermission">

        <!--Declaring the required permissions-->
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.CAMERA" />

        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="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>

activity_main.xml

.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <!-- To show toolbar-->
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:background="@color/colorPrimary"
        app:title="GFG | Permission Example"
        app:titleTextColor="@android:color/white"
        android:layout_height="?android:attr/actionBarSize"/>

    <!--Button to request storage permission-->
    <Button
        android:id="@+id/storage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Storage"
        android:layout_marginTop="16dp"
        android:padding="8dp"
        android:layout_below="@id/toolbar"
        android:layout_centerHorizontal="true"/>

    <!--Button to request camera permission-->
    <Button
        android:id="@+id/camera"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Camera"
        android:layout_marginTop="16dp"
        android:padding="8dp"
        android:layout_below="@id/storage"
        android:layout_centerHorizontal="true"/>

</RelativeLayout>

MainActivity.java

.java
import android.Manifest;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    // Defining Buttons
    private Button storage, camera;

    // Defining Permission codes.
    // We can give any value
    // but unique for each permission.
    private static final int CAMERA_PERMISSION_CODE = 100;
    private static final int STORAGE_PERMISSION_CODE = 101;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        storage = findViewById(R.id.storage);
        camera = findViewById(R.id.camera);

        // Set Buttons on Click Listeners
        storage.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v)
            {
                checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, STORAGE_PERMISSION_CODE);
            }
        });

        camera.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v)
            {
                checkPermission(Manifest.permission.CAMERA, CAMERA_PERMISSION_CODE);
            }
        });
    }

    // Function to check and request permission.
    public void checkPermission(String permission, int requestCode)
    {
        if (ContextCompat.checkSelfPermission(MainActivity.this, permission) == PackageManager.PERMISSION_DENIED) {

            // Requesting the permission
            ActivityCompat.requestPermissions(MainActivity.this, new String[] { permission }, requestCode);
        }
        else {
            Toast.makeText(MainActivity.this, "Permission already granted", Toast.LENGTH_SHORT).show();
        }
    }

    // This function is called when the user accepts or decline the permission.
    // Request Code is used to check which permission called this function.
    // This request code is provided when the user is prompt for permission.

    @Override
    public void onRequestPermissionsResult(int requestCode,
                                        @NonNull String[] permissions,
                                        @NonNull int[] grantResults)
    {
        super.onRequestPermissionsResult(requestCode,
                                        permissions,
                                        grantResults);

        if (requestCode == CAMERA_PERMISSION_CODE) {
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                Toast.makeText(MainActivity.this, "Camera Permission Granted", Toast.LENGTH_SHORT) .show();
            }
            else {
                Toast.makeText(MainActivity.this, "Camera Permission Denied", Toast.LENGTH_SHORT) .show();
            }
        }
        else if (requestCode == STORAGE_PERMISSION_CODE) {
            if (grantResults.length > 0
                && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                Toast.makeText(MainActivity.this, "Storage Permission Granted", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(MainActivity.this, "Storage Permission Denied", Toast.LENGTH_SHORT).show();
            }
        }
    }
}

Android

1. What is Mobile application?

3. What is Android?

4. Enlist features of Android OS?

5. State Advantages and Disadvantages of Android OS?

Advantages

Disadvantages

6. Describe Architecture of Android diagrammatically.

┌──────────────────────────────────────────────────────────────────────────────┐
│ Application                                                                  │
│ ┌────┐ ┌────────┐ ┌─────┐ ┌───────┐ ┌───┐                                    │
│ │Home│ │Contacts│ │Phone│ │Browser│ │***│                                    │
│ └────┘ └────────┘ └─────┘ └───────┘ └───┘                                    │
│                                                                              │
│ ┌────┐ ┌──────┐ ┌─────┐ ┌────────┐ ┌───┐                                     │
│ │SMS │ │E-Mail│ │Clock│ │Calander│ │***│                                     │
│ └────┘ └──────┘ └─────┘ └────────┘ └───┘                                     │
│                                                                              │
├──────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│ Application Framework                                                        │
│ ┌────────────────┐ ┌──────────────┐ ┌─────────────────┐ ┌───────────┐        │
│ │Activity Manager│ │Window Manager│ │Content Providers│ │View System│        │
│ └────────────────┘ └──────────────┘ └─────────────────┘ └───────────┘        │
│                                                                              │
│ ┌───────────────┐ ┌─────────────────┐ ┌────────────────┐ ┌────────────────┐  │
│ │Package Manager│ │Telephony Manager│ │Resource Manager│ │Location Manager│  │
│ └───────────────┘ └─────────────────┘ └────────────────┘ └────────────────┘  │
│                                                                              │
├──────────────────────────────────────────────┬───────────────────────────────┤
│ Libraries                                    │ Android Runtime               │
│ ┌───────────────┐ ┌───────────────┐ ┌──────┐ │ ┌──────────────┐              │
│ │Surface Manager│ │Media Framework│ │SQLite│ │ │Core Libraries│              │
│ └───────────────┘ └───────────────┘ └──────┘ │ └──────────────┘              │
│                                              │                               │
│ ┌─────────┐ ┌────────┐ ┌──────┐              │ ┌──────────────────────┐      │
│ │OpenGL/ES│ │FreeType│ │WebKit│              │ │Dalvik Virtual Machine│      │
│ └─────────┘ └────────┘ └──────┘              │ └──────────────────────┘      │
│                                              │                               │
│ ┌───┐ ┌───┐ ┌────┐                           │                               │
│ │SGL│ │SSL│ │Libc│                           │                               │
│ └───┘ └───┘ └────┘                           │                               │
│                                              │                               │
├──────────────────────────────────────────────┴───────────────────────────────┤
│ Linux Kernel                                                                 │
│ ┌──────────────┐ ┌─────────────┐ ┌───────────────────┐ ┌───────────────────┐ │
│ │Display Driver│ │Camera Driver│ │Flash Memory Driver│ │Binder (IPC) Driver│ │
│ └──────────────┘ └─────────────┘ └───────────────────┘ └───────────────────┘ │
│                                                                              │
│ ┌─────────────┐ ┌───────────┐ ┌────────────┐ ┌────────────────┐              │
│ │Keypad Driver│ │WiFi Driver│ │Audio Driver│ │Power Management│              │
│ └─────────────┘ └───────────┘ └────────────┘ └────────────────┘              │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

7. What is OHA?

8. Explain the term Android ecosystem in detail.

9. What are the features of Android? Enlist any six of them.

10. Explain the term Android ecosystem in detail.

  1. Android 13
  2. Android 12
  3. Android 11
  4. Android 10
  5. Android Pie
  6. Android Oreo
  7. Android Nougat
  8. Android Marshmallow
  9. Android Lollipop
  10. Android KitKat
  11. Android Jelly Bean
  12. Android Sandwich
  13. Android Honeycomb
  14. Android Gingerbread
  15. Android Froyo
  16. Android Eclair
  17. Android Donut
  18. Android 1.5
  19. Android 1.1
  20. Android 1.0

11. Explain the need of Android.

14. Explain the following terms:

(i) Android application

(ii) Android kernel

16. Describe OHA with the Help of Digram.

┌─────────┐ ┌─────────┐ ┌────────────┐ ┌──────┐ ┌───────────────┐
│Software │ │Mobile   │ │Handset     │ │Chip  │ │Commercializton│
│Companies│ │Operators│ │Manufactures│ │Makers│ │Companies      │
└─────┬───┘ └─────┬───┘ └─────┬──────┘ └───┬──┘ └────────┬──────┘
      │           │           │            │             │
      └───────────┴───────────┼────────────┴─────────────┘
                       ┌──────┴───────┐
                       │Open Handset  │
                       │Alliance (OHA)│
                       └──────────────┘

17. Enlist and explain any 4 features of Android.

19. Explain the concept of Android Ecosystem.

20. Explain any 4 advantages and disadvantages of Android OS.

Advantages

Disadvantages

21. Describe the concept of Anatomy of Android Application.

22. Draw and explain the architecture of Android.

┌──────────────────────────────────────────────────────────────────────────────┐
│ Application                                                                  │
│ ┌────┐ ┌────────┐ ┌─────┐ ┌───────┐ ┌───┐                                    │
│ │Home│ │Contacts│ │Phone│ │Browser│ │***│                                    │
│ └────┘ └────────┘ └─────┘ └───────┘ └───┘                                    │
│                                                                              │
│ ┌────┐ ┌──────┐ ┌─────┐ ┌────────┐ ┌───┐                                     │
│ │SMS │ │E-Mail│ │Clock│ │Calander│ │***│                                     │
│ └────┘ └──────┘ └─────┘ └────────┘ └───┘                                     │
│                                                                              │
├──────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│ Application Framework                                                        │
│ ┌────────────────┐ ┌──────────────┐ ┌─────────────────┐ ┌───────────┐        │
│ │Activity Manager│ │Window Manager│ │Content Providers│ │View System│        │
│ └────────────────┘ └──────────────┘ └─────────────────┘ └───────────┘        │
│                                                                              │
│ ┌───────────────┐ ┌─────────────────┐ ┌────────────────┐ ┌────────────────┐  │
│ │Package Manager│ │Telephony Manager│ │Resource Manager│ │Location Manager│  │
│ └───────────────┘ └─────────────────┘ └────────────────┘ └────────────────┘  │
│                                                                              │
├──────────────────────────────────────────────┬───────────────────────────────┤
│ Libraries                                    │ Android Runtime               │
│ ┌───────────────┐ ┌───────────────┐ ┌──────┐ │ ┌──────────────┐              │
│ │Surface Manager│ │Media Framework│ │SQLite│ │ │Core Libraries│              │
│ └───────────────┘ └───────────────┘ └──────┘ │ └──────────────┘              │
│                                              │                               │
│ ┌─────────┐ ┌────────┐ ┌──────┐              │ ┌──────────────────────┐      │
│ │OpenGL/ES│ │FreeType│ │WebKit│              │ │Dalvik Virtual Machine│      │
│ └─────────┘ └────────┘ └──────┘              │ └──────────────────────┘      │
│                                              │                               │
│ ┌───┐ ┌───┐ ┌────┐                           │                               │
│ │SGL│ │SSL│ │Libc│                           │                               │
│ └───┘ └───┘ └────┘                           │                               │
│                                              │                               │
├──────────────────────────────────────────────┴───────────────────────────────┤
│ Linux Kernel                                                                 │
│ ┌──────────────┐ ┌─────────────┐ ┌───────────────────┐ ┌───────────────────┐ │
│ │Display Driver│ │Camera Driver│ │Flash Memory Driver│ │Binder (IPC) Driver│ │
│ └──────────────┘ └─────────────┘ └───────────────────┘ └───────────────────┘ │
│                                                                              │
│ ┌─────────────┐ ┌───────────┐ ┌────────────┐ ┌────────────────┐              │
│ │Keypad Driver│ │WiFi Driver│ │Audio Driver│ │Power Management│              │
│ └─────────────┘ └───────────┘ └────────────┘ └────────────────┘              │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

Application

Application Framework

Android Runtime

Platform Libraries

Linux Kernel

Android Application Components

2. Installing and Configuration of Android

1. What is OS? Explain OS requirements for Android.

2. What is JDK?

3. What is SDK?

5. Describe DVM with diagram.

                                 ┌───────────┐
    ┌───────────┬──────────┬─────┤Android SDK├──────────┬───────────┐
    │           │          │     └─────┬─────┘          │           │
    │           │          │           │                │           │
┌───┴────┐ ┌────┴────┐ ┌───┴────┐ ┌────┴────────┐ ┌─────┴─────┐ ┌───┴─────┐
│Debugger│ │Libraries│ │Emulator│ │Documentation│ │Sample Code│ │Tutorials│
└────────┘ └─────────┘ └────────┘ └─────────────┘ └───────────┘ └─────────┘

What is JVM? Compare JVM and DVM?

JVM DVM
JVM supports multiple OS DVM supports only Android OS
JVM forms separate classes in separate .class byte code files. DVM forms multiple class .dex byte code file.
It is based on stack based VM architecture. It is based on register based VM architecture.
JVM runs on more memory. DVM runs on less memory.
The executable format of JVM is JAR. The executable format of DVM is APK.
JVM has different content pools. DVM has common constant pool.
It runs .class byte code directly. The .class byte codes are optimized to .odex format before executing in DVM.

7. Explain the term emulator in detail.

8. What is ADT? Describe in detail.

10. Differentiate between JDK and SDK.

SDK JDK
Software development kit. Java development kit.
It is a set of software or development tools used to create an application or a program on any platform. It is a set of development tools that allows a programmer write a program using Java language.
Libraries, sample code, supporting documentation etc. Consists of the programming tool's selection components.
Android SDK Java 8, Java 11, etc.

11. Define the terms: JDK, SDK, AVD, ADT

Explain AVD in detail.

18. Differentiate between JVM and DVM.

JVM DVM
JVM supports multiple OS DVM supports only Android OS
JVM forms separate classes in separate .class byte code files. DVM forms multiple class .dex byte code file.
It is based on stack based VM architecture. It is based on register based VM architecture.
JVM runs on more memory. DVM runs on less memory.
The executable format of JVM is JAR. The executable format of DVM is APK.
JVM has different content pools. DVM has common constant pool.
It runs .class byte code directly. The .class byte codes are optimized to .odex format before executing in DVM.

3. UI Components and Layouts

2. Explain screen elements for Android.

3. What is directory?

4. Describe directory structure in detail.

5. Explain the term fundamentals of UI design in detail.

6. What is meant by layout?

A layout defines the stucture for User Interface in the application. There are number of Layouts provided by Android which we will use in almost all the Android applicatoins to provide different view, look and feel.

7. Explain Linearlayout with example.

8. Describe FrameLayout with example.

9. Explain the following terms:

(i) TableLayout

(ii) AbsoluteLayout

10. Define the term Layout.

A layout defines the stucture for User Interface in the application. There are number of Layouts provided by Android which we will use in almost all the Android applicatoins to provide different view, look and feel.

11. Write down the control flow of an Android application step by step.

13. List the different components of a screen.

14. Explain the term fundamentals of UI design in detail.

15. List various layouts used in Android UI design.

4. Designing User Interface with View

1. What is UI?

2. Enlist elements of UI.

3. What is TextView? How to create it? Explain with example.

4. Explain the term Button with example.

5. What is ImageButton? How to create it? Explain with example.

6. Describe the following UI elements with example.

(i) ListView

(iii) GridView

(iv) imageview.

7. explain radiogroup with example.

8. With the help of example describe ToggleButton.

10. How to custom toast alert?

11. Describe Date and Time picker with example.

DatePicker

TimePicker

12. What is progress bar? How to create it?

14. Describe the following with example:

(ii) CheckBox.

15. Draw the hierarchy of designing User Interface (UI) with View.

┌────┐
│View├───────────────────────┐
└─┬──┤                       │
  │  └────────┐              │
  │           │              │
 ┌┴───────┐ ┌─┴───────┐ ┌────┴────┐
 │TextView│ │ImageView│ │ViewGroup│
 └───┬─┬──┘ └────┬────┘ └─────────┘
     │ │         │
     │ └──────┐  └──────┐
     │        │         │
 ┌───┴────┐ ┌─┴────┐ ┌──┴────────┐
 │EditText│ │Button│ │ImageButton│
 └────────┘ └┬──┬─┬┘ └───────────┘
             │  │ │
    ┌────────┘  │ └──────────┐
    │           │            │
 ┌──┴─────┐ ┌───┴───────┐ ┌──┴─────────┐
 │CheckBox│ │RadioButton│ │ToggleButton│
 └────────┘ └───────────┘ └────────────┘

16. Describe the term "edit text" with example.

5. Activity & Multimedia with Database

Activity

Draw the activity life cycle.

                             ┌┬────────┬┐
                             ││Activity││
                             ││launched││
                             └┴────┬───┴┘
                              ┌────▼─────┐
         ┌────────────────────►onCreate()│
         │                    └────┬─────┘
         │                         │
         │                    ┌────▼────┐                    ┌───────────┐
         │                    │onStart()◄────────────────────┤onRestart()│
         │                    └────┬────┘                    └───────▲───┘
         │                         │                                 │
User navigates                ┌────▼─────┐                           │
to the activity               │onResume()◄───────────────┐           │
         │                    └────┬─────┘               │           │
         │                         │                     │           │
  ┌┬─────┴─────┬┐            ┌┬────┴───┬┐                │           │
  ││App process││            ││Activity││                │           │
  ││killed     ││            ││Running ││                │           │
  └┴─────▲─────┴┘            └┴────┬───┴┘                │           │
         │                         │                     │           │
         │                         ▼                     │           │
Apps with higher priority   Another activity comes   User returns    │
need memory                 into the foreground      to the activity │
         │                         │                     │           │
         │                         │                     │           │
         │                    ┌────▼────┐                │           │
         │                    │onPause()├────────────────┘           │
         │                    └────┬────┘                            │
         │                         │                                 │
         │                         │                                 │
         │                  The activity is                          │
         │                  no longer visible                        │
         │                         │                        User navigates
         │                         │                        to the activity
         │                    ┌────▼───┐                             │
         └────────────────────┤onStop()├─────────────────────────────┘
                              └────┬───┘
                            The activity is finishing or
                            being destroyed by the system
                              ┌────▼──────┐
                              │onDestroy()│
                              └────┬──────┘
                             ┌┬────▼────┬┐
                             ││Activity ││
                             ││Shut Down││
                             └┴─────────┴┘

Explain activity lifecycle?

What are intents(Implict and explicit intent)?

Implicit intent

The implicit intent is the intent where instead of defining the exact components, you define the action that you want to perform for different activities.

Explicit intent

An explicit intent is an intent where you explicitly define the component that needs to be called by Android System. An explicit intent is one that you use to launch a specific app component, such s a particular activity or service in your app.

Explain content provider?

List sensors in Android and explain anyone in detail.

The Android platform supports following three broad categories of sensors:

Motion Sensors:

Position Sensors

These are used to measure the physical position of device.

Environmental Sensors

These are used to measure the environmental changes such as temperature, humidity etc

Define Services in Android OS.

CONTENT URI

WORKING OF THE CONTENT PROVIDER

CREATE CONTENT PROVIDER

This involves number of simple steps to create your own content provider.

FRAGMENT

ANDROID FRAGMENT LIFECYCLE METHODS

Method Description
onAttach(Activity) it is called only once when it is attached with activity.
onCreate(Bundle) It is used to initialize the fragment.
onCreateView(LayoutInflater, ViewGroup, Bundle) creates and returns view hierarchy.
onActivityCreated(Bundle) It is invoked after the completion of onCreate() method.
onViewStateRestored(Bundle) It provides information to the fragment that all the saved state of fragment view hierarchy has been restored.
onStart() makes the fragment visible.
onResume() makes the fragment interactive.
onPause() is called when fragment is no longer interactive.
onStop() is called when fragment is no longer visible.
onDestroyView() allows the fragment to clean up resources.
onDestroy() allows the fragment to do final clean up of fragment state.
onDetach() It is called immediately prior to the fragment no longer being associated with its activity.

MEDIAPLAYER CLASS

TEXTTOSPEECH

Android AsyncTask example and explanation

Methods of AsyncTask

Generic Types in Async Task

LOCATION BASED SERVICES

SMS TELEPHONY

1. Write a program to place Name, Age, Mobile number linearly(vertical) on the display screen using Linear layout.

.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:paddingTop="16dp"
    android:orientation="vertical"
    tools:context=".MainActivity">
    <TextView
        android:id="@+id/student_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Name:" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Age:" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Mobile Number:" />
</LinearLayout>

Source

2. Write a program to place Name, Age, Mobile number linearly(vertical) on the display screen using Absolute layout.

.xml
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="16dp"
    android:paddingTop="16dp"
    android:paddingRight="16dp"
    tools:context=".MainActivity">
    <TextView
        android:id="@+id/student_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="125dp"
        android:layout_y="280dp"
        android:text="Name:"
        android:textColor="#86AD33"
        android:textSize="20dp"
        android:textStyle="bold" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="125dp"
        android:layout_y="304dp"
        android:text="Age:"
        android:textColor="#86AD33"
        android:textSize="20dp"
        android:textStyle="bold" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="125dp"
        android:layout_y="328dp"
        android:text="Mobile Number:"
        android:textColor="#86AD33"
        android:textSize="20dp"
        android:textStyle="bold" />
</AbsoluteLayout>

Source

3. Write a program to display 5 students basic information in a table form using Table layout.

.xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:collapseColumns="*"
    android:shrinkColumns="*"
    tools:context=".MainActivity">
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="10 Students Basic Information"
            android:textColor="#86AD33"
            android:textSize="20dp"
            android:textStyle="bold" />
    </TableRow>
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:text="Student Numbers"
            android:textColor="#000"
            android:textStyle="bold" />
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:text="Name"
            android:textColor="#000"
            android:textStyle="bold" />
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:text="RollNo"
            android:textColor="#000"
            android:textStyle="bold" />
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:text="Age"
            android:textColor="#000"
            android:textStyle="bold" />
    </TableRow>
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="Student 1:"
            android:textColor="#86AD33"
            android:textStyle="bold" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
    </TableRow>
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:text="Student 2:"
            android:textColor="#86AD33"
            android:textStyle="bold" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
    </TableRow>
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:text="Student 3:"
            android:textColor="#86AD33"
            android:textStyle="bold" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
    </TableRow>
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:text="Student 4:"
            android:textColor="#86AD33"
            android:textStyle="bold" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
    </TableRow>
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:text="Student 5:"
            android:textColor="#86AD33"
            android:textStyle="bold" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
        <EditText
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content" />
    </TableRow>
</TableLayout>

Source

4. Write a program to accept username and password from the end user using Text View and edit Text.

.xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="50dp"
    tools:context=".MainActivity">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textSize="25dp"
        android:text="Login Page" />
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal">
        <TextView
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="Enter UserName:" />

        <EditText
            android:id="@+id/user"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:hint="abc@gmail.com" />
    </TableRow>
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal">
        <TextView
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="Enter Password:" />
        <EditText
            android:id="@+id/pass"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:hint="1234" />
    </TableRow>
    <Button
        android:id="@+id/btn1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="172dp"
        android:text="Login" />
</TableLayout>
.java
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
   EditText user,pass;
    Button b;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        b= findViewById(R.id.btn1);
        user = findViewById(R.id.user);
        pass = findViewById(R.id.pass);
        b.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(user.getText().toString().equals("atharva") & pass.getText().toString().equals("1234"))
?
                {
                    Toast.makeText( getApplicationContext(),"Login Sucessful",Toast.LENGTH_SHORT).show();
                }
                else
                {
                    Toast.makeText( getApplicationContext(),"Login UnSucessful",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}

Source

5. Write a program to create a toggle button to display ON/OFF Bluetooth on the display screen.

.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:padding="20dp">
    <ToggleButton
        android:id="@+id/toggleButton"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:text="ToggleButton"
        android:textOn="ON"
        android:textOff="OFF"
        android:textSize="20sp"
        android:layout_centerInParent="true"/>
    <TextView android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/toggleButton"
        android:text="Bluetooth is OFF"
        android:gravity="center_horizontal"
        android:layout_marginTop="20dp"
        android:textSize="20sp"
        android:textColor="@color/colorAccent"/>
</RelativeLayout>
.java
package com.example.togglebuttonbluetooth;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.ToggleButton;

public class MainActivity extends AppCompatActivity {

    ToggleButton toggleButton;
    TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        toggleButton = findViewById(R.id.toggleButton);
        textView = findViewById(R.id.textView);

        toggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

                if(isChecked)
                {
                    textView.setText("Bluetooth is " + toggleButton.getTextOn());
                }
                else
                {
                    textView.setText("Bluetooth is " + toggleButton.getTextOff());
                }
            }
        });
    }
}

Source

6. Write a program to create a login form for a social networking site.

.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#495B8F"
    android:padding="20dp"
    tools:context=".MainActivity">

    <TextView android:id="@+id/logo"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:text="F A C E B O O K"
        android:gravity="center"
        android:textSize="40sp"
        android:textStyle="bold"
        android:layout_marginTop="40dp"
        android:textColor="@android:color/white"/>

    <EditText
        android:id="@+id/username"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_below="@id/logo"
        android:layout_marginTop="30dp"
        android:background="@android:color/white"
        android:fontFamily="monospace"
        android:hint="Email or phone number"
        android:padding="10dp"
        android:textSize="22sp" />

    <EditText
        android:id="@+id/password"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_below="@id/username"
        android:background="@android:color/white"
        android:fontFamily="monospace"
        android:hint="Password"
        android:padding="10dp"
        android:layout_marginTop="20dp"
        android:textSize="22sp" />

    <Button android:id="@+id/btnLogin"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_below="@id/password"
        android:layout_marginTop="30dp"
        android:text="Log In"
        android:background="#6D9ADD"
        android:textColor="@android:color/white"
        android:textSize="18sp"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:text="Forgot Password?"
        android:textColor="@android:color/white"
        android:layout_below="@id/btnLogin"
        android:layout_marginTop="10dp"
        android:textSize="16sp"/>

</RelativeLayout>
.java
package com.example.socialnetworkingapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

Source

7. Write a program to show five checkboxes and toast selected checkbox.

.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="10dp"
    tools:context=".MainActivity">

    <CheckBox
        android:id="@+id/cb1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Android"
        android:textSize="25dp"
        android:layout_gravity="center"
        android:padding="10dp"
        android:checked="false"/>

    <CheckBox
        android:id="@+id/cb2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Pythpn"
        android:textSize="25dp"
        android:layout_gravity="center"
        android:padding="10dp"
        android:checked="false"/>
    <CheckBox
        android:id="@+id/cb3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="PHP"
        android:textSize="25dp"
        android:layout_gravity="center"
        android:padding="10dp"
        android:checked="false"/>
    <CheckBox
        android:id="@+id/cb4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="C"
        android:textSize="25dp"
        android:layout_gravity="center"
        android:padding="10dp"
        android:checked="false"/>
    <CheckBox
        android:id="@+id/cb5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Java"
        android:textSize="25dp"
        android:layout_gravity="center"
        android:padding="10dp"
        android:checked="false"/>

    <Button
        android:id="@+id/btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Submit"
        android:textSize="35dp"
        android:layout_gravity="center"
        android:padding="10dp"/>
</LinearLayout>

Source

8. Write a program to display circular progress bar.

.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <RelativeLayout
        android:id="@+id/progress_layout"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_margin="100dp">

        <!--progress bar implementation-->
        <ProgressBar
            android:id="@+id/progress_bar"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/circular_shape"
            android:indeterminate="false"
            android:progressDrawable="@drawable/circular_progress_bar"
            android:textAlignment="center" />

        <!--Text implementation in center of the progress bar-->
        <TextView
            android:id="@+id/progress_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:gravity="center"
            android:text="---"
            android:textColor="@color/colorPrimary"
            android:textSize="28sp"
            android:textStyle="bold" />
    </RelativeLayout>

</LinearLayout>
.java
import android.os.Bundle;
import android.os.Handler;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private ProgressBar progressBar;
    private TextView progressText;
    int i = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // set the id for the progressbar and progress text
        progressBar = findViewById(R.id.progress_bar);
        progressText = findViewById(R.id.progress_text);

        final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                // set the limitations for the numeric
                // text under the progress bar
                if (i <= 100) {
                    progressText.setText("" + i);
                    progressBar.setProgress(i);
                    i++;
                    handler.postDelayed(this, 200);
                } else {
                    handler.removeCallbacks(this);
                }
            }
        }, 200);
    }
}

Source

9. Write a program to display 15 buttons using Grid view.

Source

10. Write a program to display a toast message

.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    Button b1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        b1 = (Button) findViewById(R.id.toast_button);

        b1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this,"You just Toasted me!!!",Toast.LENGTH_LONG).show();
                /*Another way to display a Toast message
                    Toast t=Toast.makeText(MainActivity.this,"You just Toasted me!!!",Toast.LENGTH_LONG);
                    t.show();
                */
            }
        });
    }

}
.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="codedost.toast.MainActivity">

    <Button
        android:id="@+id/toast_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Toast me!"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
    />

</RelativeLayout>

Source

MAD QUESTION BANK

1. Write the syntax for Intent-Filter tag.

.xml
<intent-fliter
android:icon="drawable resource"
android:label="string resource"
android:priority="integer">
</intent-fliter>

2. Define Services in Android OS.

1. Started

2. Bound

3. Enlist the steps to publish the Android application

5. What is Date and Time picker with its methods?

Date Picker

TimePicker

6. Write a program to display circular progress bar.

.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="https://schemas.android.com/apk/res/android"
  xmlns:app="https://schemas.android.com/apk/res-auto"
  xmlns:tools="https://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity">
  <Button
    android:id="@+id/btnDownloadFile"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Download File"
    andorid:layout_centerInParent="true" />
</RelativeLayout>

7. List sensors in Android and explain anyone in detail.

The Android supports broad categories of sensors:

  1. Motion Sensors
  2. Enviromental Sensors
  3. Position Sensors

Montion Sensors:

8. Develop the registration form using the following GUI.

.xml
<RelativeLayout
  xmlns:android="https://schemas.android.com/apk/res/android"
  xmlns:tools="https://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="wrap_content"
  android:paddingTop="wrap_content"
  tools:context=".MainActivity">
  <FrameLayout>
    <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/banner_image" />
  <FrameLayout>
  <EditText
    android:id="@+id/editText1"
    android:hint="Name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:drawableLeft="@drawable/name_image" />
  <EditText
    android:id="@+id/editText2"
    android:hint="Email ID"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:drawbleLeft="@drawable/email_image" />
  <EditText
    android:id="@+id/editText1"
    android:hint="Password"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:drawableLeft="@drawable/pass_image" />
  <EditText
    android:id="@+id/editText1"
    android:hint="Confirm Password"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_cneterVertical="true"
    android:drawableLeft="@drawable/conpass_image" />
  <EditText
    android:id="@+id/editText1"
    android:hint="Enter Mobile"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:drawableLeft="@drawable/mobile_image" />
  <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" />
  <Button
    android:id="@+id/btnDisplay"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Register" />
</RelativeLayout>

(thk to SaturoGojoo,AK,NEWBIEN00B)

1) What is android?

Android is a mobile operating system based on a modified version of the Linux kernel and other open source software, designed primarily for touchscreen mobile devices such as smartphones and tablets.

2) Enlist Features of android?

3) Explain android architecture?

4) Explain android sdk?

5) What is Android AVD?

Hardware profile

System image

Storage Area

6) What is emulator?

The Android Emulator simulates Android devices on your computer so that you can test your application on a variety of devices and Android API levels without needing to have each physical device.

7) Difference between JVM and dVM?

JVM DVM
JVM supports multiple OS DVM supports only Android Operating system.
JVM forms separate classes in separate .class byte code files. DVM forms multiple class in .dex byte code file.
It is based on stack based virtual machine architecture. It is based on register based virtual machine architecture.
JVM runs on more memory DVM runs on less memory.
The executable format of JVM is JAR. The executable format of DVM is APK.
JVM has different constant pools. DVM has common constant pool.
It runs .class byte code directly. The .class byte codes are optimize to .odex format before executing in DVM.

8) What are activities?

  1. Activities dictate the UI and handles the user interaction to the smart phone screen.
  2. Activities represent a single screen that user interact.

9) What are services?

Foreground service

Backgroud Service**

Bound Service

10) What are intents(Implict and explicit intent)?

Implicit intent

The implicit intent is the intent where instead of defining the exact components, you define the action that you want to perform for different activities.

Explicit intent

An explicit intent is an intent where you explicitly define the component that needs to be called by Android System. An explicit intent is one that you use to launch a specific app component, such s a particular activity or service in your app.

11) Explain main Activity file ,manifest and layout file?

MainActivity file The main activity. Java file is automatically kept in this folder by Android studio all the classes will be available here and Android studio will even bundle together the package so that we can work with the file without having to go through all the folders.

Manifest file It contains an Android manifest.xml file that is generated by Android studio when we create a project. This file contains the configuration parameters of a project such as Permission services and additional libraries.

Layout file Layout specifies the various widgets to be used in the UI and the relationships between such widgets and their containers. Layout files are stored in "res-> layout" in the Android application.

12) What are different types of UI compents?

TextView TextView is a UI Component that displays the text to the user on their Display Screen. EditText EditText is a user interface control that allows the users to enter some text. Button This is a UI that is used to perform some action as soon as the user clicks on it. ProgressBar Progress bars are used to show progress of a task. For example, when you are uploading or downloading something from the internet, it is better to show the progress of download/upload to the user. In android there is a class called Progress Dialog that allows you to create progress bar.

13) What are Layouts (LinearLayout, AbsoluteLayout, TableLayout, FrameLayout, RelativeLayout)?

LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally. AbsoluteLayout enables us to specify the exact location of its children. TableLayout is a view that groups views into rows and columns. RelativeLayout is a view group that displays child views in relative positions. FrameLayout is a placeholder on screen that we can use to display a single view.

14) Define: textview, Edittextview, Button, Image button, checkbox(attributes and methods)?

15) Explain listview, gridview, imageview, scrollview?

16) What is toast explain with example?

Activity Lifecycle Image-->

18) Explain broadcast receivers?

Broadcast Receivers simply respond to broadcast messages from other applications or from the system itself. These messages are sometime called events or intents.

Creating the Broadcast Receiver

A broadcast receiver is implemented as a subclass of Broadcast Receiver class and overriding the onReceive() method where each message is received as an Intent object parameter.

Registering Broadcast Receiver

An application listens for specific broadcast intents by registering a broadcast receiver in AndroidManifest.xml file. Consider we are going to register MyReceiver for system generated event ACTION_BOOT_COMPLETED which is fired by the system once the Android system has completed the boot process.

19) Explain content provider?

Android system allows the content provider to store the application data in several ways. Users can manage to store the application data like images, audio, videos, and personal contact information by storing them in SQLite Database, in files, or even on a network. In order to share the data, content providers have certain permissions that are used to grant or restrict the rights to other applications to interfere with the data.

20) What is sensors?

Mostion sensors

These sensors measure acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors.

Environmental sensors

These sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers.

Position sensors

These sensors measure the physical position of a device. This category includes orientation sensors and magnetometers.

21) What is location based services?

Location Based Services: Creating the Project, Getting the Maps API Key, Displaying the Map, Displaying the Zoom Control, Navigating to a Specific Location, Adding Markers, Getting Location,Geocoding and Reverse Geocoding, Getting Location Data, Monitoring Location.

22) What is Geo code and reverse Geo code?

Geo code

Geocoding is the process of converting addresses (like a street address) into geographic coordinates (like latitude and longitude), which you can use to place markers on a map, or position the map.

Reverse Geo code

Reverse geocoding is the process of converting geographic coordinates into a human-readable address.

23) Enlist Steps to publish android application?

Step 1: First generate signed apk of your Android App to publish it on Play Store. Step 2: Sign up for Google Play Console to publish and manage your Android App. Step 3: Now click on Create Application. Step 4: Now fill store listing details of your App which include Title, Short and Full description. Step 5: Now Click on ready on publish along with save draft and click on Manage release. Step 6: After Manage production click on edit release. Step 7: Now click on review. Step 8: After review click on Start Rollout to production.

24) What is Date and time Picker?

Datepicker

Timepicker

1) What is Android?

Android is mobile OS based on modified version of Linux kernel and other open source software, designed primarily for touchscreen mobile devices such as smartphones and tablets.

2) Enlist features of Android?

3) Explain Android architecture?

4) Explain Android SDK?

5) What is Android AVD?

Hardware profile

System image

Storage Area

6) What is emulator?

The Android Emulator simulates Android devices on your computer so that you can test your application on a variety of devices and Android API levels without needing to have each physical device.

7) Difference between JVM and DVM?

JVM DVM
JVM supports multiple OS DVM supports only Android OS
JVM forms separate classes in separate .class byte code files. DVM forms multiple class in .dex byte code file.
JVM runs on more memory DVM runs on less memory.
The executable format of JVM is JAR The executable format of DVM is APK.
JVM has different constant pools. DVM has common constant pool.
It runs .class byte code directly.. The .class byte codes are optimize to .odex format before executing in DVM.
JVM has different constant pools. DVM has common constant pool.

8) What are activities?

9) What are services?

Foreground service

Background Service

Bound Service

10) What are intents?

Implicit intent

The implicit intent is the intent where instead of defining the exact components , you define the action that you want to perform for different activities.

Explicit intent

An explicit intent is an intent where you explicitly define the component that needs to be called by Android System. An explicit intent is one that you use to launch a specific app component, such as particular activity or service in your app.

11) Explain MainActivity, Manifest & Layout file?

MainActivity

The MainActivity.java file is automatically kept in main folder by Android Studio all the classes will be available here and Android Studio will even bundle together the package so that we can work with the file without having to go through all the folders.

Manifest

Manifest file generated by Android Studio when we create a project. This file contains the configuration parameters of a project such as permission services and additional libraries.

Layout

Layout specifies the various widgets to be used in UI and the relationships between such widgets and their containers. Layout files are stored in res->layout in the Android application.

12) What are different types of UI components?

13) What are Layouts?

14) Define

15) Explain

16) What is toast explain with example?

17) Explain activity life cycle?

18) Explain broadcast receivers?

Broadcast Receivers simply respond to broadcast messages from other applications or from the system itself. These messages are sometime called events or intents.

Creating the Broadcast Receiver

A broadcast receiver is implemented as a subclass of Broadcast Receiver class and overriding the onReceive() method where each message is received as an Intent object parameter.

Registering Broadcast Receiver

An application listens for specific broadcast intents by registering a broadcast receiver in AndroidManifest.xml file. Consider we are going to register My Receiver for system generated event ACTION_BOOT_COMPLETED which is fired by the system once the Android system has completed the boot process.

19) Explain content provider?

20) What is sensors?

Motion

These sensors measure acceleration forces and rotational forces along three axes . This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector.

Environmental

These sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers.

Position

These sensors measure the physical position of a device. This category includes orientation sensors and magnetometers.

21) What is location based services?

Location Based Services: Location-Based Services(LBS) are present in Android to provide you with features like current location detection, display of nearby places, Geofencing, etc. It fetches the location using your device’s GPS, WiFi, or Cellular Networks.

22) What is Geo code and Reverse geo code?

Geo code

Geocoding is the process of converting addresses (like a street address) into geographic coordinates (like latitude and longitude), which you can use to place markers on a map, or position the map.

Reverse Geo code

Reverse geocoding is the process of converting geographic coordinates into a human-readable address.

23) Enlist Steps to publish android application?

24) What is date and time picker?

DatePicker

TimePicker

Table of Content