0% found this document useful (0 votes)
24 views12 pages

Mad Previous Chat

The document outlines a preparation plan for a Mobile Application Development (MAD) exam, focusing on core programming topics and frequently asked questions based on past papers. It provides a structured approach to coding essential Android applications using Java, including a login form, a simple calculator, and an image display feature. Additionally, it lists important Android methods and classes that are crucial for the exam.

Uploaded by

pareshloq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views12 pages

Mad Previous Chat

The document outlines a preparation plan for a Mobile Application Development (MAD) exam, focusing on core programming topics and frequently asked questions based on past papers. It provides a structured approach to coding essential Android applications using Java, including a login form, a simple calculator, and an image display feature. Additionally, it lists important Android methods and classes that are crucial for the exam.

Uploaded by

pareshloq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 12

now i want to do programs for my mad(mobile application development) exam

ChatGPT said:
Great — I can help you prepare Mobile Application Development (MAD) programs for
your exam.

To begin, could you tell me:

Which programming language or framework your syllabus uses? (e.g., Java with
Android Studio, Kotlin, Flutter with Dart)

Do you have a list of practical questions or expected programs?

Do you prefer easier versions of the code with step-by-step comments?

Once I know these, I’ll start preparing the programs accordingly.

You said:
2023-Summer-question-paper[Msbte study resources].pdf
PDF
2023-Winter-question-paper[Msbte study resources].pdf
PDF
2024-Summer-question-paper.pdf
PDF
2024-winter-question-paper.pdf
PDF
ocr mad syllabus.pdf
PDF
these are each years question papers and my syllabus

ChatGPT said:

Thought for 8 seconds


I’ve gone through your past papers and the MAD syllabus – there’s a clear overlap
in the “compulsory” practicals (marked with “*” in the syllabus) and the programs
that keep popping up in your exams. Here’s a plan we can follow:

Pick off the core “must-know” apps (from the syllabus’s compulsory list):

Layouts: Linear & Absolute; Frame, Table & Relative

Basic UI controls: TextView/EditText; Button/ImageButton/ToggleButton; Checkbox;


RadioButton/RadioGroup; ProgressBar

Containers & views: ListView, GridView, ImageView, ScrollView, AutoCompleteTextView

Pickers & dialogs: DatePicker & TimePicker

Navigation & multi-screen: Explicit & Implicit Intents; Fragments

Background & sensors: BroadcastReceiver; Service or AsyncTask; Sensors


Device features: Camera capture; Bluetooth connectivity; Text-to-speech / Speech-
to-text; Maps (API key + map display)

Messaging: Send/Receive SMS; Send/Receive Email

Map these topics to your exam questions so you’ll be ready for anything that comes
up.

Decide on your stack:

Java (Android Studio + XML) or Kotlin?

Minimum SDK version?

Any particular architectural pattern (e.g. MVVM)?

Start coding: Pick one program at a time. For each, I’ll provide:

The XML layout file

The Java/Kotlin Activity class

Step-by-step comments explaining each part

To kick off, let me know:

Which of the “must-know” programs above you want to tackle first. (For example:
“Linear & Absolute Layout example” or “Date and Time Picker app.”)

Your preferred language (Java vs. Kotlin).

Once you tell me where to begin, I’ll draft the full layout and code.

You said:
i am doing java. give me "must do, most asked" programming questions
ChatGPT said:
Perfect. Based on the MSBTE syllabus and repeated patterns in the 2023 & 2024
question papers (summer and winter), here are the "must-do" and most frequently
asked Java-based Android programs for your MAD exam:

✅ Most Asked & Must-Do Android Programs (Java)


# Program Topic Description
1 Linear & Relative Layout Create a basic login form using LinearLayout
and RelativeLayout
2 TextView, EditText, Button Simple calculator app (addition/subtraction)
3 ImageView & ImageButton Display image on button click
4 CheckBox & RadioButton Food ordering app using checkbox (multiple) and radio
buttons (single select)
5 ListView with ArrayAdapter Display a list of countries or fruits
6 GridView Display a photo grid or icons
7 AutoCompleteTextView Suggest city or country names
8 ScrollView Registration form inside a ScrollView
9 DatePicker & TimePicker App to select date and time for an appointment
10 Intent (Explicit & Implicit) Explicit: Move from one screen to another
Implicit: Open browser or call dialer
11 Fragment Example Simple fragment switching using buttons or navigation bar
12 Toast & AlertDialog Use toast to show message; AlertDialog for
confirmation
13 BroadcastReceiver Detect airplane mode or network change
14 Services (Background Task) Download simulator or music playback
(simulated)
15 Sensor Example Detect shake using accelerometer
16 Camera App Open camera, click photo and display
17 Text-to-Speech / Speech-to-Text Convert typed text to speech or use voice
input
18 Google Maps (Basic) Display map using Maps API key
19 Send SMS App to send SMS using Intent
20 Email Intent Open email app with pre-filled recipient and message

These 20 cover 90% of past paper questions and match your MAD syllabus compulsory
list.

Would you like me to begin with Program 1: Linear & Relative Layout Login Form
using Java and XML?

You said:
get me through codes
ChatGPT said:
Updated saved memory
Great! Let's start with the first program and move down the list.

✅ Program 1: Login Form using LinearLayout and RelativeLayout


🎯 Objective
Create a login screen using LinearLayout and RelativeLayout with fields for
username and password, and a login button.

📁 1. activity_main.xml (Layout using LinearLayout inside RelativeLayout)


xml
Copy code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">

<LinearLayout
android:id="@+id/loginForm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical"
android:padding="24dp"
android:background="#EEEEEE">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:textSize="24sp"
android:textStyle="bold"
android:layout_gravity="center"/>

<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username"
android:inputType="textPersonName"
android:layout_marginTop="16dp"/>

<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
android:layout_marginTop="8dp"/>

<Button
android:id="@+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:layout_marginTop="16dp"/>
</LinearLayout>
</RelativeLayout>
📂 2. MainActivity.java (Logic in Java)
java
Copy code
package com.example.loginapp;

import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

EditText username, password;


Button loginButton;

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

// Linking XML views to Java


username = findViewById(R.id.username);
password = findViewById(R.id.password);
loginButton = findViewById(R.id.loginButton);

// Button click listener


loginButton.setOnClickListener(v -> {
String user = username.getText().toString();
String pass = password.getText().toString();

// Simple validation
if(user.equals("admin") && pass.equals("1234")) {
Toast.makeText(this, "Login successful",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Invalid credentials",
Toast.LENGTH_SHORT).show();
}
});
}
}
📌 Output
Displays a login screen centered.

Checks hardcoded username (admin) and password (1234).

Shows toast for success/failure.

Would you like to proceed to Program 2: Calculator using TextView, EditText, and
Button next?

You said:
next
ChatGPT said:
Great! Let’s move to:

✅ Program 2: Simple Calculator App (Addition & Subtraction)


Using TextView, EditText, and Button

🎯 Objective
Create an app that takes two numbers and performs addition or subtraction when the
respective button is clicked.

📁 1. activity_main.xml
xml
Copy code
<?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"
android:gravity="center_horizontal">

<EditText
android:id="@+id/number1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter first number"
android:inputType="numberDecimal"
android:layout_marginTop="20dp" />

<EditText
android:id="@+id/number2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter second number"
android:inputType="numberDecimal"
android:layout_marginTop="10dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:gravity="center_horizontal">

<Button
android:id="@+id/addButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add" />

<Button
android:id="@+id/subtractButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Subtract"
android:layout_marginStart="20dp" />
</LinearLayout>

<TextView
android:id="@+id/resultText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Result:"
android:textSize="20sp"
android:layout_marginTop="30dp" />
</LinearLayout>
📂 2. MainActivity.java
java
Copy code
package com.example.calculatorapp;

import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

EditText number1, number2;


Button addButton, subtractButton;
TextView resultText;

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

// Link views
number1 = findViewById(R.id.number1);
number2 = findViewById(R.id.number2);
addButton = findViewById(R.id.addButton);
subtractButton = findViewById(R.id.subtractButton);
resultText = findViewById(R.id.resultText);

// Add button logic


addButton.setOnClickListener(v -> {
try {
double num1 = Double.parseDouble(number1.getText().toString());
double num2 = Double.parseDouble(number2.getText().toString());
double sum = num1 + num2;
resultText.setText("Result: " + sum);
} catch (Exception e) {
Toast.makeText(this, "Please enter valid numbers",
Toast.LENGTH_SHORT).show();
}
});

// Subtract button logic


subtractButton.setOnClickListener(v -> {
try {
double num1 = Double.parseDouble(number1.getText().toString());
double num2 = Double.parseDouble(number2.getText().toString());
double difference = num1 - num2;
resultText.setText("Result: " + difference);
} catch (Exception e) {
Toast.makeText(this, "Please enter valid numbers",
Toast.LENGTH_SHORT).show();
}
});
}
}
📌 Output
User inputs two numbers.

Taps Add or Subtract.

Result is displayed below the buttons.

Would you like to proceed to Program 3: ImageView & ImageButton (show image on
click)?

You said:
give me a list of all the most important methods i will need for this exam
ChatGPT said:
Here is a concise list of important Android methods and classes in Java that are
frequently used in Mobile Application Development (MAD) practicals and are
essential for your MSBTE exam:

✅ Most Important Android Methods and Classes (Java)


🔹 Activity Lifecycle Methods
Method Purpose
onCreate(Bundle) Initializes activity, sets layout
onStart() Activity is becoming visible
onResume() Activity is now interacting with the user
onPause() Pause interactions (e.g., when another activity appears)
onStop() Activity is no longer visible
onDestroy() Final cleanup

🔹 UI Component Methods
Method Used For
findViewById(R.id.id) Link XML UI to Java
setText(String) Set text in TextView, EditText, etc.
getText().toString() Get input text
setOnClickListener() Handle button clicks
setImageResource(R.drawable.img) Set image in ImageView
setEnabled(true/false) Enable/disable UI element
setVisibility(View.VISIBLE / GONE / INVISIBLE) Show/hide views

🔹 Intent Methods
Method Purpose
new Intent(Context, TargetActivity.class) Start new screen (explicit intent)
startActivity(intent) Launch activity
putExtra(key, value) Pass data via intent
getIntent().getStringExtra(key) Receive data

🔹 Toast & Dialog


Method Purpose
Toast.makeText(this, msg, duration).show() Show small message
AlertDialog.Builder Show alert/confirmation box
setTitle(), setMessage(), setPositiveButton() Dialog customization

🔹 Date & Time Pickers


Method Use
DatePickerDialog Show date picker dialog
TimePickerDialog Show time picker dialog
onDateSet() / onTimeSet() Handle selected date/time

🔹 BroadcastReceiver & Services


Method/Class Use
BroadcastReceiver Receive system events (e.g., SMS, battery)
registerReceiver() / unregisterReceiver() Register/deregister receiver
IntentFilter Set which events to receive
Service Background task component
startService(intent) / stopService(intent) Start/stop service

🔹 Sensors
Class/Method Use
SensorManager Access device sensors
getSystemService(SENSOR_SERVICE) Get sensor manager
registerListener() Start listening to sensor
onSensorChanged() Handle sensor data

🔹 Text-to-Speech & Speech-to-Text


Method Use
TextToSpeech Convert text to voice
tts.speak(text, ...) Speak text
RecognizerIntent.ACTION_RECOGNIZE_SPEECH Launch speech input
startActivityForResult(intent, code) Start speech recognition
onActivityResult() Handle result of speech input

🔹 Others
Method/Class Use
ArrayAdapter Connect list/grid data to views
ListView.setAdapter() / GridView.setAdapter() Populate list/grid
AutoCompleteTextView.setAdapter() Suggest as user types
ScrollView Scrollable form/layout
Camera Intent Launch camera
BluetoothAdapter Enable/disable Bluetooth
Geocoder / GoogleMap For location-based apps

Let me know if you'd like a printable one-page version of this list or want to
continue to the next program: ImageView & ImageButton.

You said:
next program
ChatGPT said:
Let's continue with:

✅ Program 3: ImageView and ImageButton Example


🎯 Objective:
Display an image when an ImageButton is clicked. This shows use of ImageView,
ImageButton, and event handling.

📁 1. activity_main.xml
xml
Copy code
<?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:gravity="center"
android:padding="20dp">

<ImageView
android:id="@+id/imageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/placeholder"
android:scaleType="fitCenter"
android:contentDescription="Image View"
android:layout_marginBottom="20dp" />

<ImageButton
android:id="@+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/show"
android:background="@android:color/transparent"
android:contentDescription="Show Image Button" />
</LinearLayout>
📝 Note: You must place two images in your res/drawable/ folder:

placeholder.png: initial image

show.png: image to be displayed on button


You can use sample icons like animals or logos.

📂 2. MainActivity.java
java
Copy code
package com.example.imageexample;

import android.os.Bundle;
import android.widget.ImageButton;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

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

imageView = findViewById(R.id.imageView);
imageButton = findViewById(R.id.imageButton);

// On click, update image in ImageView


imageButton.setOnClickListener(v -> {
imageView.setImageResource(R.drawable.show);
});
}
}
📌 Output
Initially, a placeholder image is shown.

On tapping the ImageButton, it replaces the image in the ImageView.

Would you like to move to Program 4: CheckBox & RadioButton (Food Ordering App)
next?

You said:
next
ChatGPT said:
Great! Let’s move on to:

✅ Program 4: Food Ordering App Using CheckBox and RadioButton


🎯 Objective:
Use CheckBox to select multiple food items and RadioButton to choose delivery type.
Show the selected items and delivery method on button click.

📁 1. activity_main.xml
xml
Copy code
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Food Items"
android:textSize="18sp"
android:textStyle="bold"/>
<CheckBox android:id="@+id/cbPizza" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Pizza" />
<CheckBox android:id="@+id/cbBurger" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Burger" />
<CheckBox android:id="@+id/cbPasta" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Pasta" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Choose Delivery Method"
android:layout_marginTop="20dp"
android:textSize="18sp"
android:textStyle="bold"/>

<RadioGroup android:id="@+id/radioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton android:id="@+id/rbHome"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Home Delivery" />
<RadioButton android:id="@+id/rbPickup"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Pickup" />
</RadioGroup>

<Button
android:id="@+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:layout_marginTop="20dp" />

<TextView
android:id="@+id/txtResult"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Your Order Details"
android:layout_marginTop="20dp"
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
📂 2. MainActivity.java
java
Copy code
package com.example.foodorder;

import android.os.Bundle;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

CheckBox cbPizza, cbBurger, cbPasta;


RadioGroup radioGroup;
RadioButton rbHome, rbPickup;
Button btnSubmit;
TextView txtResult;

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

cbPizza = findViewById(R.id.cbPizza);
cbBurger = findViewById(R.id.cbBurger);
cbPasta = findViewById(R.id.cbPasta);

radioGroup = findViewById(R.id.radioGroup);
rbHome = findViewById(R.id.rbHome);
rbPickup = findViewById(R.id.rbPickup);

btnSubmit = findViewById(R.id.btnSubmit);
txtResult = findViewById(R.id.txtResult);

btnSubmit.setOnClickListener(v -> {
StringBuilder result = new StringBuilder("Selected Items:\n");

if (cbPizza.isChecked()) result.append("- Pizza\n");


if (cbBurger.isChecked()) result.append("- Burger\n");
if (cbPasta.isChecked()) result.append("- Pasta\n");

int selectedId = radioGroup.getCheckedRadioButtonId();


if (selectedId != -1) {
RadioButton selectedRadio = findViewById(selectedId);
result.append("Delivery: ").append(selectedRadio.getText());
} else {
result.append("No delivery option selected.");
}

txtResult.setText(result.toString());
});
}
}
📌 Output
User can select one or more food items.

User selects one delivery option.

On submit, selected items and method are displayed.

Would you like to continue with Program 5: ListView using ArrayAdapter?

You might also like