Skip to content
Ananda Technologies Pvt. Ltd.

Mobile Application Development practicals — MSBTE

Every practical of MSBTE K-scheme Mobile Application Development (316006) with 3 different tested programs, real output, explanation and viva questions.

✅ Solved by Ananda TechnologiesDiplomaSemester 6MSBTE K-schemeCode 316006CO, IF, CM, CW, SE, IH, AN, AI, DSQuestion papers →
Build your own practical file in 3 steps
  1. 1Tick one answer (A, B or C) for the questions you need — one practical or all.
  2. 2Press Generate PDF at the bottom. First time: free account (asked only once).
  3. 3Choose Save as PDF in the print window. Print again any time.

💡 Explain buttons are for your understanding — explanations are never printed.

Practical 1Compulsory

Install Android Studio, create an Android Virtual Device and set up React Native

Aim: Install the Android IDE, create and start an emulator (AVD), run a first app; set up the React Native environment.

Qa) Install and configure the Android IDE and create an Android Virtual Device (AVD). b) Install and configure the React Native environment.

Showing answer A of 3 · tap A, B or C to see the others

  1. Download Android Studio from developer.android.com/studio and install it (keep "Android Virtual Device" ticked).
  2. First start: choose Standard setup; it downloads the Android SDK, platform tools and an emulator image.
  3. New Project → Empty Views Activity → Name: MyApp, Language: Java, Minimum SDK: API 24 → Finish.
  4. Tools → Device Manager → Create Device → Pixel 6 → system image (e.g. API 34) → Next → Finish.
  5. Press the green Run ▶ button and pick the AVD. Wait for the emulator to boot; the app opens.

Output

The emulator opens a phone window
and the app shows in the centre:
Android Studio is ready!
Running on: sdk_gphone64_x86_64
Android version: 14
API level: 34
(The model and version are those of
the AVD you created.)
// FILE: 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:gravity="center"
    android:orientation="vertical"
    android:padding="24dp">
🎤 Viva questions (5)
Q. What is an AVD?
A. Android Virtual Device — an emulator configuration (phone model + Android version) to run apps on the PC.
Q. What is the Android SDK?
A. Software Development Kit: tools, libraries and platform files needed to build Android apps.
Q. What does Gradle do in Android Studio?
A. It builds the project: compiles code, packs resources and creates the APK.
Q. What is React Native?
A. A JavaScript framework by Meta for building native Android and iOS apps from one code base.
Q. What is an APK?
A. Android Package — the file that installs an app on a phone.

Practical 2

Display "Hello World" on the screen

Aim: Create a first Android app that displays Hello World using XML and Java.

QDevelop a program to display "Hello World" on the screen.

Showing answer A of 3 · tap A, B or C to see the others

Output

A white screen with "Hello World" in
large bold letters in the centre.
// FILE: activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
🎤 Viva questions (5)
Q. What is an Activity?
A. One screen of an Android app with a user interface; it extends Activity/AppCompatActivity.
Q. What is the use of setContentView()?
A. It sets the layout (UI) that the activity displays.
Q. What is the difference between dp and sp?
A. dp is used for sizes and margins; sp is used for text and also follows the user's font size.
Q. What is the R class?
A. An auto-generated class that holds ids of all resources (layouts, strings, views).
Q. What is a Toast?
A. A short pop-up message that disappears automatically.

Practical 3Compulsory

Explore the directory structure of an Android project

Aim: Understand manifests, java, res (layout, values, drawable, mipmap) and Gradle files of an Android project.

QExplore the directory structure of an Android project in the Android IDE and use its resource folders.

Showing answer A of 3 · tap A, B or C to see the others

  1. Switch the Project window to the "Android" view (top-left drop-down).
  2. app → manifests → AndroidManifest.xml: app name, icon, activities, permissions.
  3. app → java → com.example.myapp: MainActivity.java and other classes (androidTest/test hold tests).
  4. app → res: drawable (images/shapes), layout (screens), mipmap (launcher icons), values (strings, colors, themes).
  5. Gradle Scripts → build.gradle (Module :app): applicationId, minSdk, targetSdk, dependencies.

Output

Heading "Project Structure" in dark
blue, followed by four light-blue
boxes:
manifests/ – AndroidManifest.xml
java/ – Activity and other Java
classes
res/ – layouts, images, strings,
colours
Gradle Scripts – build.gradle files
// FILE: res/values/strings.xml
<resources>
    <string name="title">Project Structure</string>
    <string name="java_folder">java/ – Activity and other Java classes</string>
    <string name="res_folder">res/ – layouts, images, strings, colours</string>
    <string name="manifest_folder">manifests/ – AndroidManifest.xml</string>
    <string name="gradle_folder">Gradle Scripts – build.gradle files</string>
</resources>
🎤 Viva questions (5)
Q. What is AndroidManifest.xml?
A. The file that declares the app's package, components (activities, services, receivers) and permissions.
Q. What is stored in the res folder?
A. Resources: layouts, drawables, mipmap icons, values (strings, colours, dimens, themes).
Q. What is the difference between drawable and mipmap?
A. mipmap holds launcher icons in many densities; drawable holds other images and shapes.
Q. What is build.gradle (Module :app)?
A. Build settings of the app: applicationId, SDK versions, dependencies.
Q. What is the R.java (R class)?
A. Auto-generated class with integer ids for every resource.

Practical 4Compulsory

App using TextView and EditText

Aim: Accept input with EditText and show results in TextView.

QDevelop a program to implement TextView and EditText.

Showing answer A of 3 · tap A, B or C to see the others

Output

Screen: "Enter your name", a text
box (hint "e.g. Priya") and a GREET
ME button.
Type Priya and tap the button →
below it shows in bold blue: Hello
Priya, welcome to MAD practicals!
Tap with an empty box → red error
"Please enter your name".
// FILE: 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="24dp">
🎤 Viva questions (5)
Q. What is the difference between TextView and EditText?
A. TextView only displays text; EditText (a subclass of TextView) lets the user type.
Q. What is the use of android:hint?
A. Grey placeholder text shown when the EditText is empty.
Q. What does inputType do?
A. Chooses the keyboard and input rules (number, email, password, phone…).
Q. How do you read text from an EditText?
A. editText.getText().toString().
Q. What is TextWatcher?
A. An interface with beforeTextChanged, onTextChanged and afterTextChanged to react while text changes.

Practical 5Compulsory

Button, ImageButton and ToggleButton

Aim: Handle clicks on Button, ImageButton and ToggleButton.

QDevelop a program to implement Button, ImageButton and ToggleButton.

Showing answer A of 3 · tap A, B or C to see the others

Output

A full-width NORMAL BUTTON, a phone
(call) icon button and a WI-FI OFF
toggle.
Tap Normal → "Normal Button
clicked". Tap the phone icon →
"ImageButton (Call) clicked". Tap
the toggle → it shows WI-FI ON and
the text "Toggle is ON".
// FILE: 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:gravity="center_horizontal"
    android:orientation="vertical"
    android:padding="24dp">
🎤 Viva questions (5)
Q. What is the difference between Button and ImageButton?
A. Button shows text; ImageButton shows an image (src).
Q. What is a ToggleButton?
A. A button with two states (on/off) and different text for each state.
Q. Which listener is used for ToggleButton?
A. CompoundButton.OnCheckedChangeListener (setOnCheckedChangeListener).
Q. What are textOn and textOff?
A. Texts shown on a ToggleButton for the ON and OFF states.
Q. Name two ways to handle a button click.
A. setOnClickListener in Java, or android:onClick attribute in XML.

Practical 6Compulsory

CheckBox and RadioButton

Aim: Allow multiple choices with CheckBox and one choice with RadioButton in a RadioGroup.

QDevelop a program to implement CheckBox and RadioButton.

Showing answer A of 3 · tap A, B or C to see the others

Output

Three item check boxes, payment
radio buttons (Cash selected) and
PLACE ORDER.
Tick Tea and Sandwich, choose UPI,
tap PLACE ORDER →
Items: Tea, Sandwich
Total: Rs. 55
Payment: UPI
// FILE: 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="20dp">
🎤 Viva questions (5)
Q. What is the difference between CheckBox and RadioButton?
A. CheckBoxes allow many selections; radio buttons in a group allow only one.
Q. Why is RadioGroup needed?
A. It makes its radio buttons mutually exclusive.
Q. How do you know which RadioButton is selected?
A. radioGroup.getCheckedRadioButtonId(), then findViewById(id).
Q. Which method tells if a CheckBox is ticked?
A. isChecked().
Q. What does getCheckedRadioButtonId() return when nothing is selected?
A. -1.

Practical 7

ProgressBar

Aim: Show progress with horizontal and circular ProgressBars and update them from code.

QDevelop a program to implement ProgressBar.

Showing answer A of 3 · tap A, B or C to see the others

Output

A horizontal bar filled 30%, the
text "30%" and two buttons - 10 and
+ 10.
Tap + 10 seven times → the bar is
full and the text says "100% -
Complete!". - 10 empties it step by
step.
// FILE: 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:gravity="center"
    android:orientation="vertical"
    android:padding="24dp">
🎤 Viva questions (5)
Q. What are the two types of ProgressBar?
A. Determinate (horizontal, shows exact progress) and indeterminate (spinning, unknown duration).
Q. Which methods set the progress?
A. setProgress(int) and setMax(int); getProgress() reads it.
Q. Why can't we update the ProgressBar directly from a Thread?
A. Views are not thread-safe; only the UI thread may change them (use runOnUiThread or a Handler).
Q. What is secondaryProgress?
A. A second fill level, e.g. buffered part of a video.
Q. How do you hide a ProgressBar?
A. setVisibility(View.GONE) or View.INVISIBLE.

Practical 8Compulsory

Login form using UI controls

Aim: Create a login screen with EditText, Button, CheckBox and validation.

QDevelop a login form using the above UI controls.

Showing answer A of 3 · tap A, B or C to see the others

Output

Title "Student Login", Username and
Password boxes and a LOGIN button.
student / mad@123 → green "Login
successful. Welcome student!"
Wrong password → red "Invalid
username or password". Short
password → error "Minimum 6
characters" on the field.
// FILE: 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:gravity="center_vertical"
    android:orientation="vertical"
    android:padding="28dp">
🎤 Viva questions (5)
Q. Which inputType hides a password?
A. textPassword (or numberPassword for digits).
Q. How do you show an error on an EditText?
A. editText.setError("message").
Q. What is SharedPreferences?
A. A simple key–value storage to save small data such as settings or a saved email.
Q. Why should passwords not be stored in plain text?
A. Anyone with access to the phone or database could read them; they should be hashed on a server.
Q. How do you disable a button?
A. button.setEnabled(false).

Practical 9Compulsory

LinearLayout and ConstraintLayout: registration form with a custom Toast

Aim: Design a registration form with LinearLayout and ConstraintLayout and show a custom Toast alert.

QDevelop a registration form using LinearLayout and ConstraintLayout and display a custom Toast alert.

Showing answer A of 3 · tap A, B or C to see the others

Output

Title "Registration", fields Full
name, Email, Mobile and Branch |
Semester side by side, and REGISTER.
After filling the form and tapping
REGISTER, a green box with a tick
icon and white text "Registered:
Riya Patil" appears in the middle of
the screen for about 3 seconds.
// FILE: 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="24dp">
🎤 Viva questions (5)
Q. What is the difference between LinearLayout and ConstraintLayout?
A. LinearLayout arranges children in one row or column; ConstraintLayout positions each view with constraints relative to others, giving flat layouts.
Q. What is layout_weight?
A. It divides the remaining space of a LinearLayout among children in a ratio.
Q. What is a custom Toast?
A. A Toast whose look comes from our own layout, set with toast.setView().
Q. What does 0dp mean in ConstraintLayout?
A. Match constraints — the view takes the space between its constraints.
Q. What is a chain in ConstraintLayout?
A. A group of views linked to each other in both directions, sharing space (spread, packed, weighted).

Practical 10

FrameLayout, TableLayout and RelativeLayout for an e-commerce app

Aim: Design e-commerce screens using FrameLayout, TableLayout and RelativeLayout.

QDevelop a program to implement FrameLayout, TableLayout and RelativeLayout for an e-commerce application.

Showing answer A of 3 · tap A, B or C to see the others

Output

A light-blue banner with a camera
icon in the middle, a red "40% OFF"
badge at the top-left and a dark
strip at the bottom "Pocket Camera ·
Rs. 2,999". Below it ADD TO CART.
Tapping the button shows Toast
"Pocket Camera added to cart" and
the button text becomes "Added (1)",
"Added (2)"...
// FILE: 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">
🎤 Viva questions (5)
Q. What is FrameLayout used for?
A. To stack views on top of each other, e.g. badges or captions over images.
Q. What are TableRow and stretchColumns?
A. TableRow is one row of a TableLayout; stretchColumns lets columns expand to fill the width.
Q. Name four RelativeLayout attributes.
A. layout_below, layout_toStartOf, layout_alignParentEnd, layout_centerInParent.
Q. Which layout is recommended instead of RelativeLayout today?
A. ConstraintLayout.
Q. What does layout_gravity do in a FrameLayout?
A. It decides where a child is placed inside the frame (top, bottom, center...).

Practical 11Compulsory

GridView, ImageView, ScrollView and ListView for a management system

Aim: Show lists and grids with adapters, images and scrolling screens for a library / hotel management app.

QDevelop a program to implement GridView, ImageView, ScrollView and ListView for a management system (library / hotel).

Showing answer A of 3 · tap A, B or C to see the others

Output

Blue header "College Library" and a
list of 5 books, each row with a
book icon, bold title, author name
and a status on the right (green
"Available" or red "Issued").
Tap "Java: The Complete Reference" →
Toast "Java: The Complete Reference
is already issued".
// FILE: 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">

    <TextView android:layout_width="match_parent" android:layout_height="wrap_content"
🎤 Viva questions (5)
Q. What is an Adapter?
A. A bridge between data and an AdapterView (ListView, GridView, Spinner) that creates a view for each item.
Q. What is the difference between ListView and GridView?
A. ListView shows one column of rows; GridView shows items in multiple columns.
Q. Why must ScrollView have only one child?
A. It scrolls a single content view; put a LinearLayout inside to hold many views.
Q. What is convertView?
A. A recycled row view passed to getView() so it can be reused instead of inflating a new one.
Q. What does notifyDataSetChanged() do?
A. Tells the adapter the data changed so the list/grid redraws.

Practical 12

Simple calculator using GridLayout

Aim: Arrange calculator buttons in a GridLayout and perform arithmetic.

QDevelop a simple calculator using a grid layout.

Showing answer A of 3 · tap A, B or C to see the others

Output

A black display showing 0 and a 4 ×
4 keypad filling the rest of the
screen:
7 8 9 /
4 5 6 *
1 2 3 -
C 0 = +
Press 1 2 * 4 = → display shows 48.
9 / 0 = shows "Error". C clears to
0.
// FILE: 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="12dp">
🎤 Viva questions (5)
Q. What is GridLayout?
A. A layout that places children in rows and columns; cells can span rows/columns.
Q. What is the difference between GridLayout and GridView?
A. GridLayout is a static layout of fixed views; GridView is a scrolling AdapterView for many items.
Q. How do you make a button span two columns?
A. android:layout_columnSpan="2".
Q. What is android:onClick in XML?
A. It names a public method void name(View v) in the activity that runs on click.
Q. How do you handle divide by zero in the calculator?
A. Check the divisor before dividing (or check for Infinity/NaN) and show a message.

Practical 13Compulsory

Splash screen

Aim: Show a splash screen for a few seconds and then open the main screen.

QDevelop a program to implement a splash screen.

Showing answer A of 3 · tap A, B or C to see the others

Output

App opens on a dark-blue screen with
a yellow star, "Campus App" and
"Your college in your pocket".
After 3 seconds the "Home screen"
appears. Pressing Back exits the app
(it does not go back to the splash).
// FILE: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application>
        <activity android:name=".SplashActivity" android:exported="true"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
🎤 Viva questions (5)
Q. What is a splash screen?
A. The first screen shown for a short time while the app starts, usually with a logo.
Q. Why do we call finish() in the splash activity?
A. So the splash is removed and Back does not return to it.
Q. Which component starts the next activity?
A. An Intent: startActivity(new Intent(this, MainActivity.class)).
Q. What is a Handler used for here?
A. To run code after a delay on the main thread (postDelayed).
Q. Which intent-filter makes an activity the launcher?
A. action MAIN with category LAUNCHER.

Practical 14Compulsory

Converter app: temperature, currency, volume

Aim: Build unit converters using EditText, Spinner and buttons.

QDevelop a converter application (temperature / currency / volume).

Showing answer A of 3 · tap A, B or C to see the others

Output

Heading "Temperature Converter", a
value box, °C / °F / K radio buttons
and CONVERT.
Enter 98.6, choose °F, CONVERT →
Celsius    : 37.00 °C
Fahrenheit : 98.60 °F
Kelvin     : 310.15 K
// FILE: 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="24dp">
🎤 Viva questions (5)
Q. What is a Spinner?
A. A drop-down list that lets the user pick one value.
Q. Which listener is used for Spinner selection?
A. AdapterView.OnItemSelectedListener (onItemSelected / onNothingSelected).
Q. Why convert to a base unit first?
A. Then only one rate per unit is needed instead of a rate for every pair.
Q. How would you get live currency rates?
A. Call an exchange-rate web API (with INTERNET permission) and parse its JSON.
Q. What is the formula for °F to °C?
A. C = (F − 32) × 5 / 9.

Practical 15

Countdown timer

Aim: Use CountDownTimer to build start / pause / reset timers.

QDevelop a simple countdown timer.

Showing answer A of 3 · tap A, B or C to see the others

Output

A big "00:30" with START and STOP.
START → 00:30, 00:29, 00:28 … every
second, then "Time up!". STOP resets
it to 00:30.
// FILE: 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:gravity="center"
    android:orientation="vertical">
🎤 Viva questions (5)
Q. What is CountDownTimer?
A. An Android class that counts down a total time and calls onTick() at intervals and onFinish() at the end.
Q. What are the two parameters of CountDownTimer?
A. millisInFuture (total time) and countDownInterval (tick interval) in milliseconds.
Q. How do you stop a CountDownTimer?
A. Call cancel().
Q. Why cancel the timer in onDestroy()?
A. Otherwise it keeps running and updates views of a closed activity.
Q. Can CountDownTimer be paused?
A. Not directly; save the remaining time, cancel it and start a new timer later.

Practical 16Compulsory

Date Picker

Aim: Select dates with the DatePicker widget and DatePickerDialog.

QDevelop a program to implement Date Picker.

Showing answer A of 3 · tap A, B or C to see the others

Output

A calendar of the current month with
today highlighted, a SHOW DATE
button and an empty text.
Select 15 and tap SHOW DATE →
"Selected date: 15/11/2026" (month
and year as shown on the calendar).
// FILE: 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:gravity="center_horizontal"
    android:orientation="vertical"
    android:padding="12dp">
🎤 Viva questions (5)
Q. What is the difference between DatePicker and DatePickerDialog?
A. DatePicker is a widget inside the layout; DatePickerDialog shows it in a pop-up dialog.
Q. Why do we add 1 to getMonth()?
A. Months are numbered 0–11 in Android/Java Calendar.
Q. How do you block past dates?
A. datePicker.setMinDate(System.currentTimeMillis()).
Q. Which listener returns the chosen date in a dialog?
A. DatePickerDialog.OnDateSetListener (onDateSet(view, year, month, day)).
Q. Which class formats a date as text?
A. SimpleDateFormat (or java.time.format.DateTimeFormatter).

Practical 17

Time Picker

Aim: Select time with the TimePicker widget and TimePickerDialog.

QDevelop a program to implement Time Picker.

Showing answer A of 3 · tap A, B or C to see the others

Output

A clock-face time picker with AM/PM.
Selecting 3:45 PM shows below:
"Selected: 03:45 PM  (24-hour
15:45)".
// FILE: 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:gravity="center_horizontal"
    android:orientation="vertical"
    android:padding="12dp">
🎤 Viva questions (5)
Q. What are the two modes of TimePicker?
A. clock (analog face) and spinner (scrolling wheels).
Q. How do you show 24-hour format?
A. setIs24HourView(true), or pass true to TimePickerDialog.
Q. Which listener gives the selected time in TimePickerDialog?
A. OnTimeSetListener (onTimeSet(view, hourOfDay, minute)).
Q. What range does hourOfDay have?
A. 0 to 23.
Q. How do you follow the phone's 12/24-hour setting?
A. android.text.format.DateFormat.is24HourFormat(context).

Practical 18

Two activities for a login application

Aim: Move from a login activity to a second activity, passing data with an Intent.

QDevelop a program to create two simple activities for a login application.

Showing answer A of 3 · tap A, B or C to see the others

Output

Login screen with Username, Password
and LOGIN.
admin / 1234 → a new screen
"Welcome, admin!" and "Logged in at
10:42:15 AM". Back returns to the
login screen. Wrong details → Toast
"Wrong username or password".
// FILE: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application>
        <activity android:name=".MainActivity" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
🎤 Viva questions (5)
Q. What is an Intent?
A. A message object used to start an activity/service or to deliver a broadcast.
Q. How do you pass data between activities?
A. putExtra() on the intent and getIntent().getXxxExtra() in the new activity.
Q. What does finish() do?
A. Closes the current activity and removes it from the back stack.
Q. What is the back stack?
A. The stack of opened activities; Back pops the top one.
Q. How does an activity return a result?
A. setResult(RESULT_OK, intent) then finish(); the caller receives it via ActivityResultLauncher.

Practical 19Compulsory

Explicit intent and implicit intent

Aim: Open a new activity with an explicit intent and open a website (and other apps) with implicit intents.

Q1Program 1: create a new activity using an explicit intent.

Showing answer A of 3 · tap A, B or C to see the others

Output

Name and marks boxes with SHOW
RESULT. Enter "Om Jadhav" and 82 → a
new screen with a back arrow: "Om
Jadhav · 82/100" and a big green
"Distinction". With 35 marks the
grade is a red "Fail".
// FILE: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application>
        <activity android:name=".MainActivity" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />

Q2Program 2: use an implicit intent to open a website.

Showing answer A of 3 · tap A, B or C to see the others

Output

Two buttons. OPEN MSBTE WEBSITE
opens msbte.ac.in in Chrome (or asks
which browser to use). OPEN ANDROID
DEVELOPERS SITE opens
developer.android.com. Back returns
to the app.
// FILE: 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="24dp">
    <Button android:id="@+id/btnMsbte" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Open MSBTE website" />
🎤 Viva questions (5)
Q. What is the difference between explicit and implicit intents?
A. Explicit names the target class; implicit gives an action/data and Android finds a suitable app.
Q. Which action opens a web page?
A. Intent.ACTION_VIEW with an http/https Uri.
Q. What is an intent filter?
A. Manifest entry that says which implicit intents (actions, categories, data) a component can handle.
Q. What does Intent.createChooser() do?
A. Shows a dialog to choose which app should handle the intent.
Q. Why catch ActivityNotFoundException?
A. If no installed app can handle the implicit intent, startActivity throws it.

Practical 20Compulsory

Services like Bluetooth and Wi-Fi

Aim: Turn on/off and use Bluetooth, list paired devices and check/open Wi-Fi settings with proper permissions.

QDevelop a program to use services like Bluetooth / Wi-Fi.

Showing answer A of 3 · tap A, B or C to see the others

Output

A Bluetooth icon, the status
"Bluetooth is OFF" and three
buttons. First launch asks "Allow
app to find, connect to… nearby
devices?".
TURN ON → system dialog; after Allow
the status shows "Bluetooth is ON".
MAKE VISIBLE → "make your phone
visible for 120 seconds?". TURN OFF
→ on Android 13+ opens the Bluetooth
settings page; on older phones Toast
"Bluetooth turned OFF".
// FILE: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
    <application>
🎤 Viva questions (5)
Q. Which class controls Bluetooth?
A. BluetoothAdapter (obtained from BluetoothManager).
Q. Which permission is needed for Bluetooth on Android 12+?
A. BLUETOOTH_CONNECT (and BLUETOOTH_SCAN to discover devices) — runtime permissions.
Q. How do you ask the user to turn on Bluetooth?
A. startActivity(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)).
Q. Which class gives the Wi-Fi state?
A. WifiManager (isWifiEnabled()).
Q. Why can't new apps switch Wi-Fi directly?
A. From Android 10 setWifiEnabled() is blocked for privacy; apps use the Settings Panel instead.

Practical 21Compulsory

Broadcast receiver: Airplane, Silent and Loud mode

Aim: Receive system broadcasts for airplane mode and ringer mode changes, and switch ringer modes.

QDevelop a program to implement a broadcast receiver for Airplane mode / Silent mode / Loud mode.

Showing answer A of 3 · tap A, B or C to see the others

Output

A plane icon and green "Airplane
mode is OFF". Turning airplane mode
ON from quick settings changes it to
red "Airplane mode is ON" with Toast
"Airplane mode ON"; turning it off
shows green "OFF" again.
// FILE: 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:gravity="center"
    android:orientation="vertical"
    android:padding="24dp">
🎤 Viva questions (5)
Q. What is a BroadcastReceiver?
A. A component that receives and reacts to broadcast intents from the system or other apps.
Q. What are the two ways to register a receiver?
A. Statically in AndroidManifest.xml, or dynamically in code with registerReceiver().
Q. Why are most implicit system broadcasts registered in code now?
A. From Android 8, manifest receivers cannot get most implicit broadcasts; dynamic registration still works.
Q. Which broadcast tells that airplane mode changed?
A. Intent.ACTION_AIRPLANE_MODE_CHANGED.
Q. Which class changes silent / vibrate / normal mode?
A. AudioManager.setRingerMode().

Practical 22Compulsory

Registration app: insert and retrieve data from a database

Aim: Store registration data in SQLite with SQLiteOpenHelper and read it back.

QDevelop a registration app to insert and retrieve data from a database.

Showing answer A of 3 · tap A, B or C to see the others

Output

Name, Email, Branch boxes with
REGISTER and VIEW ALL. Register
"Riya Patil / riya@gmail.com / co" →
Toast "Saved with id 1". After
adding two students, VIEW ALL shows:
Total: 2

1. Riya Patil | CO riya@gmail.com
2. Om Shinde | IF om@gmail.com
The data stays after closing the
app.
// FILE: DBHelper.java
package com.example.myapp;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
🎤 Viva questions (5)
Q. What is SQLite?
A. A small, file-based relational database built into Android.
Q. What is SQLiteOpenHelper?
A. A helper class that creates (onCreate) and upgrades (onUpgrade) the database.
Q. What is a Cursor?
A. An object that points to rows of a query result and lets you read columns.
Q. What is ContentValues?
A. A key–value set of column names and values used for insert and update.
Q. Why use ? placeholders in queries?
A. They pass values safely and prevent SQL injection.

Practical 23

Authentication app using a database

Aim: Register users in SQLite and authenticate them at login.

QDevelop an authentication application using a database.

Showing answer A of 3 · tap A, B or C to see the others

Output

Title "Secure Login", Username,
Password, LOGIN and "New user?
Register".
Register "meera" / "meera@12" →
green "Registered. You can log in
now." Registering again → red
"Username already taken". Login with
the right password → "Login
successful ✓"; wrong → "Invalid
username or password".
// FILE: UserDB.java
package com.example.myapp;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
🎤 Viva questions (5)
Q. What is authentication?
A. Checking who the user is, usually with a username and password.
Q. Why should passwords be hashed?
A. If the database leaks, the real passwords are not exposed.
Q. What is a salt?
A. A random value added to the password before hashing so equal passwords give different hashes.
Q. How do you keep a user logged in?
A. Save a session flag/token in SharedPreferences and check it at start.
Q. Which method returns the number of rows in a Cursor?
A. getCount().

Practical 24

MyContacts app using a database

Aim: Save, list, search, call, edit and delete contacts stored in SQLite.

QDevelop a MyContacts application using a database.

Showing answer A of 3 · tap A, B or C to see the others

Output

"My Contacts (0)", Name and Phone
boxes side by side, ADD CONTACT and
a list. After adding three contacts
the title shows "My Contacts (3)"
and the list is alphabetical, each
row with the name and the number
below it.
// FILE: ContactDB.java
package com.example.myapp;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
🎤 Viva questions (5)
Q. Which class is used to create the contacts table?
A. A subclass of SQLiteOpenHelper.
Q. How do you call a number without CALL_PHONE permission?
A. Use Intent.ACTION_DIAL with tel:number; the user presses the call button.
Q. What is SearchView?
A. A widget with a search box; OnQueryTextListener gives the typed text.
Q. How do you show a confirmation dialog?
A. AlertDialog.Builder with setMessage, setPositiveButton and setNegativeButton.
Q. What does COLLATE NOCASE do?
A. Makes comparisons/sorting ignore upper and lower case.

Practical 25

Use the camera

Aim: Capture photos with the camera app (thumbnail and full size) and pick images from the gallery.

QDevelop a program to use the camera.

Showing answer A of 3 · tap A, B or C to see the others

Output

A grey image box, OPEN CAMERA and an
empty text. The camera app opens;
after taking a photo and pressing ✓
the image appears in the box and the
text shows e.g. "Preview size: 240 ×
320 px" (a small thumbnail).
Cancelling shows "No photo taken".
// FILE: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <application>
        <activity android:name=".MainActivity" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
🎤 Viva questions (5)
Q. How do you open the camera app?
A. With an intent (MediaStore.ACTION_IMAGE_CAPTURE) or ActivityResultContracts.TakePicture / TakePicturePreview.
Q. Why is CAMERA permission not needed here?
A. The camera app takes the photo; our app only receives the result.
Q. What is FileProvider?
A. A ContentProvider that shares app files with other apps using content:// Uris.
Q. What is the difference between TakePicturePreview and TakePicture?
A. Preview returns a small Bitmap; TakePicture saves the full-size image to a Uri.
Q. Which class is used to build your own camera screen?
A. CameraX (androidx.camera) or the Camera2 API.

Practical 26Compulsory

SMS application

Aim: Send SMS with SmsManager (with permission), open the SMS app, and receive incoming SMS.

QDevelop a program to send and receive SMS.

Showing answer A of 3 · tap A, B or C to see the others

Output

Mobile number and Message boxes and
SEND SMS. The first tap asks "Allow
app to send and view SMS messages?".
After Allow, the SMS is sent from
the phone's SIM and a Toast says
"SMS sent to 9876543210". Deny →
"SMS permission denied".
(Normal SMS charges apply; on an
emulator the message goes to the
emulator's SMS log.)
// FILE: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-feature android:name="android.hardware.telephony" android:required="false" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <application>
        <activity android:name=".MainActivity" android:exported="true">
            <intent-filter>
🎤 Viva questions (5)
Q. Which class sends SMS directly?
A. SmsManager (sendTextMessage / sendMultipartTextMessage).
Q. Which permissions are needed to send and receive SMS?
A. SEND_SMS and RECEIVE_SMS (both dangerous, granted at run time).
Q. How do you open the SMS app without permission?
A. Intent ACTION_SENDTO with a smsto: Uri and the "sms_body" extra.
Q. Which broadcast is received for a new SMS?
A. android.provider.Telephony.SMS_RECEIVED (Telephony.Sms.Intents.SMS_RECEIVED_ACTION).
Q. What does divideMessage() do?
A. Splits a long text into parts that fit in single SMS messages.

Practical 27Compulsory

Send and receive e-mail

Aim: Compose and send e-mail through the e-mail app with intents, including CC/BCC and attachments, and open the inbox.

QDevelop a program to send and receive an e-mail.

Showing answer A of 3 · tap A, B or C to see the others

Output

To, Subject and Message boxes and
SEND E-MAIL. Tapping it opens Gmail
with the recipient, subject and
message already filled; the user
taps the send arrow. An invalid
address shows "Invalid e-mail".
// FILE: 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="24dp">
    <EditText android:id="@+id/etTo" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="To" android:inputType="textEmailAddress" />
🎤 Viva questions (5)
Q. Which intent action composes an e-mail?
A. ACTION_SENDTO with mailto: (or ACTION_SEND with an e-mail type).
Q. Which extras add recipients?
A. EXTRA_EMAIL, EXTRA_CC and EXTRA_BCC (String arrays).
Q. How do you attach a file?
A. Put a content:// Uri (from FileProvider) in EXTRA_STREAM and grant read permission.
Q. Why use mailto: with ACTION_SENDTO?
A. So only e-mail apps are offered in the chooser.
Q. How can an app read e-mails itself?
A. With a mail library using IMAP/POP3 and the user's login, e.g. JavaMail/Jakarta Mail.

Practical 28

Location services with permission checks

Aim: Get the current location with LocationManager after checking permissions, find the address and distance.

QDevelop a program to use location services with permission checks.

Showing answer A of 3 · tap A, B or C to see the others

Output

GET MY LOCATION and a green box. The
phone asks "Allow app to access this
device's location?" (Precise /
Approximate). After Allow:
Latitude : 19.138300
Longitude: 77.321800
Accuracy : 12 m
Provider : gps
(values of your current place; they
update while you move). Deny →
"Location permission denied…";
location off → "Location is OFF…".
// FILE: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <application>
        <activity android:name=".MainActivity" android:exported="true">
            <intent-filter>
🎤 Viva questions (5)
Q. Which permissions are needed for location?
A. ACCESS_FINE_LOCATION (precise) and/or ACCESS_COARSE_LOCATION (approximate).
Q. What are location providers?
A. GPS_PROVIDER (satellites), NETWORK_PROVIDER (Wi-Fi/cell), PASSIVE_PROVIDER.
Q. What is Geocoder?
A. A class that converts coordinates to addresses (reverse geocoding) and addresses to coordinates.
Q. Why remove location updates in onPause()?
A. To stop GPS when the app is not visible and save battery.
Q. What is FusedLocationProviderClient?
A. Google Play services API that combines GPS, Wi-Fi and sensors for battery-efficient location.

Practical 29Compulsory

Navigation drawer using fragments

Aim: Build a navigation drawer that switches between fragments.

QDevelop a program to implement a navigation drawer using fragments.

Showing answer A of 3 · tap A, B or C to see the others

Output

A blue toolbar "Home" with a ☰ icon
and the centred text "🏠 Home /
Welcome to the MAD app". Tapping ☰
(or swiping from the left edge)
slides in a drawer with Home, Notes,
About. Choosing Notes closes the
drawer, the title becomes "Notes"
and the screen shows "📒 Notes / Unit
1 to Unit 6". Back closes an open
drawer first.
// FILE: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application>
        <activity android:name=".MainActivity" android:exported="true" android:theme="@style/Theme.MaterialComponents.Light.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
🎤 Viva questions (5)
Q. What is a Fragment?
A. A reusable part of the UI with its own lifecycle that lives inside an activity.
Q. What is DrawerLayout?
A. A layout that holds the main content and a drawer that slides in from the side.
Q. What does ActionBarDrawerToggle do?
A. Adds and animates the hamburger icon and opens/closes the drawer.
Q. How do you replace a fragment?
A. getSupportFragmentManager().beginTransaction().replace(containerId, fragment).commit().
Q. How do you pass data to a fragment?
A. Put it in a Bundle and call setArguments(); read it with getArguments().

Practical 30

Flashlight app with permission checks

Aim: Turn the camera flash (torch) on and off safely after checking the hardware and permissions.

QDevelop a simple flashlight application with permission checks.

Showing answer A of 3 · tap A, B or C to see the others

Output

A dark screen with a large power
icon and "Torch OFF". The first
launch asks for the camera
permission. Tapping the icon turns
the phone's flash ON, the screen
turns light yellow and the text says
"Torch ON"; tapping again switches
it off. On a phone without flash:
"This device has no flash".
// FILE: AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-feature android:name="android.hardware.camera.flash" android:required="false" />
    <uses-permission android:name="android.permission.CAMERA" />
    <application>
        <activity android:name=".MainActivity" android:exported="true">
            <intent-filter>
🎤 Viva questions (5)
Q. Which class turns the flashlight on?
A. CameraManager.setTorchMode(cameraId, true).
Q. How do you check if a phone has a flash?
A. PackageManager.hasSystemFeature(FEATURE_CAMERA_FLASH) or FLASH_INFO_AVAILABLE.
Q. What is a runtime permission?
A. A dangerous permission the user must allow while the app is running (Android 6+).
Q. Why turn the torch off in onStop()?
A. So it does not stay on and drain the battery after leaving the app.
Q. Which method sets torch brightness?
A. turnOnTorchWithStrengthLevel() on Android 13+.

Tick the answers you want in your file

YOUR DIPLOMA, STEP BY STEP

Save this page — everything till your final year is here

Free practicals, micro projects and question papers for your semesters — and when your final year comes, ready projects with report, setup and viva help.

📲 Your class needs this too

Send it to your class WhatsApp group — practical file done in minutes for everyone, free.