Lab Report 22bce10410
Lab Report 22bce10410
NAME –
Mukul
Choudhari
REGNO –22BCE10410
Submitted to
October, 2024
Registration no: 22BCE10410
Table of Contents
AIM: To study and understand the features, tools, and functionalities of the Android Studio
Integrated Development Environment (IDE) for developing Android applications.
CODE: 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">
<TextView
android:id="@+id/helloText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, World!"
android:textSize="24sp"
android:layout_gravity="center"/>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me"
android:layout_gravity="center"
android:marginTop="20dp"/>
</LinearLayout>
MainActivity.java:
package com.example.helloworld;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
@Override
public void onClick(View v) {
helloText.setText("Button Clicked!");
}
});
}
}
DESCRIPTION: Android Studio is the official IDE for Android development provided by
Google. It includes tools for developing and testing Android applications, such as a code editor,
layout editor, emulators, and various debugging tools. It supports multiple programming
languages, including Java, Kotlin, and C++. This experiment involves exploring the Android
Studio IDE, creating a basic application, and understanding its project structure.
RESULT: The experiment results in the creation of a simple "Hello World" application in
Android Studio, which includes a TextView and a Button. When the button is clicked, the text in
the TextView changes to "Button Clicked!" This demonstrates the use of layout components and
event handling in Android.
OBSERVATION: 1. The Android Studio IDE provides a robust and user-friendly environment
for Android application development.
2. The IDE offers various tools like Logcat for debugging, layout editor for designing UI, and
code editor with IntelliSense for code completion.
3. The project structure is well-organized, and the build system (Gradle) simplifies project
management.
Exp. No: 02 Android app displaying name, reg.no and welcome message on screen
AIM: To design and implement a simple Android application that displays a user’s name,
registration number, and a welcome message using TextViews and basic layout elements.
CODE: 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"
android:gravity="center"
android:background="@android:color/holo_blue_light">
<TextView
android:id="@+id/nameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name: Mukul"
android:textSize="24sp"
android:textColor="@android:color/white"
android:layout_marginBottom="16dp"/>
<TextView
android:id="@+id/registrationText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Registration No: 22BCE10410"
android:textSize="24sp"
android:textColor="@android:color/white"
android:layout_marginBottom="16dp"/>
<TextView
android:id="@+id/welcomeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome to Android Development"
android:textSize="24sp"
android:textColor="@android:color/white"/>
</LinearLayout>
MainActivity.java:
package com.example.displayinfoapp;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// TextViews are already set up in XML, no need to programmatically change the text.
// Additional logic can be added here if needed in the future.
}
}
DESCRIPTION: This experiment involves creating a basic Android application that displays a
user’s name, registration number, and a welcome message using the Android Studio IDE. The app
consists of a single activity (MainActivity) and a corresponding layout file (activity_main.xml)
that defines the UI components. The user interface uses a LinearLayout to vertically arrange three
Name/Signature: Mukul Choudhari
Registration no: 22BCE10410
RESULT: The Android application successfully displays the following information on the screen:
Name: Mukul
Registration Number: 22BCE10410
Message: Welcome to Android Development
OBSERVATION: 1. The Android Studio IDE provides an intuitive way to design the UI using
XML layout files.
2. TextView components can be customized using various attributes like textSize, textColor, and
layout_margin.
3. The layout and structure of the application are easy to understand and modify based on
requirements.
AIM: To study and demonstrate the activity lifecycle of an Android app by displaying messages
through the Log.d() method in the Logcat console and showing Toast messages during lifecycle
events.
CODE: MainActivity.java
package com.example.lifecycleDemo;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@Override
protected void onStart() {
super.onStart();
Log.d(TAG, "onStart() called");
Toast.makeText(this, "onStart() called", Toast.LENGTH_SHORT).show();
}
@Override
protected void onResume() {
super.onResume();
Log.d(TAG, "onResume() called");
Toast.makeText(this, "onResume() called", Toast.LENGTH_SHORT).show();
}
@Override
protected void onPause() {
super.onPause();
Log.d(TAG, "onPause() called");
Toast.makeText(this, "onPause() called", Toast.LENGTH_SHORT).show();
}
@Override
protected void onStop() {
super.onStop();
Log.d(TAG, "onStop() called");
Toast.makeText(this, "onStop() called", Toast.LENGTH_SHORT).show();
}
@Override
protected void onRestart() {
super.onRestart();
Log.d(TAG, "onRestart() called");
Toast.makeText(this, "onRestart() called", Toast.LENGTH_SHORT).show();
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.d(TAG, "onDestroy() called");
Toast.makeText(this, "onDestroy() called", Toast.LENGTH_SHORT).show();
}
}
DESCRIPTION: Android applications go through several states as they are opened, minimized,
resumed, or closed. These states are defined by the activity lifecycle methods:
onCreate(): Called when the activity is created.
onStart(): Called when the activity becomes visible to the user.
onResume(): Called when the activity is ready to interact with the user.
onPause(): Called when the activity is partially obscured (e.g., user switches apps).
onStop(): Called when the activity is no longer visible.
onRestart(): Called when the activity is restarted after being stopped.
onDestroy(): Called before the activity is destroyed.
This experiment demonstrates the transitions between these states through log and toast messages,
making it easier to track and understand the lifecycle flow.
RESULT: 1. Log messages for each lifecycle event are visible in the Logcat console with the tag
"LifecycleDemo".
2. Toast messages appear on the screen during each lifecycle event.
3. The flow of messages corresponds to the lifecycle transitions, such as:
When the app starts: onCreate() -> onStart() -> onResume().
When the app is minimized: onPause() -> onStop().
When the app is reopened: onRestart() -> onStart() -> onResume().
When the app is closed: onPause() -> onStop() -> onDestroy().
OBSERVATION: 1. Each lifecycle event is correctly triggered based on user interactions with
the app.
2. The Log.d() method prints messages in the Logcat console, helping with debugging and
monitoring.
3. Toast messages provide a visible confirmation of lifecycle events on the device/emulator.
4. The order of lifecycle callbacks can vary slightly based on whether the activity is being paused,
restarted, or destroyed.
Exp. No: 04 Use two toggle button and show the staus through Toaste Message
AIM: To develop an Android application that demonstrates the use of Toggle Buttons and shows
their status through Toast messages.
CODE:
<ToggleButton
android:id="@+id/toggleButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOff="Toggle 1 OFF"
android:textOn="Toggle 1 ON"
android:layout_centerHorizontal="true"
Name/Signature: Mukul Choudhari
Registration no: 22BCE10410
android:layout_marginTop="50dp" />
<ToggleButton
android:id="@+id/toggleButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOff="Toggle 2 OFF"
android:textOn="Toggle 2 ON"
android:layout_below="@id/toggleButton1"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp" />
<Button
android:id="@+id/statusButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Status"
android:layout_below="@id/toggleButton2"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp" />
</RelativeLayout>
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.widget.ToggleButton;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toggleButton1 = findViewById(R.id.toggleButton1);
Name/Signature: Mukul Choudhari
Registration no: 22BCE10410
toggleButton2 = findViewById(R.id.toggleButton2);
statusButton = findViewById(R.id.statusButton);
statusButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String status1 = toggleButton1.isChecked() ? "ON" : "OFF";
String status2 = toggleButton2.isChecked() ? "ON" : "OFF";
RESULT: When the user clicks the "Show Status" button, a Toast message appears, showing
whether Toggle 1 and Toggle 2 are ON or OFF.
OBSERVATION: 1. The Toggle Buttons successfully switch between ON and OFF states.
2. The Toast messages correctly display the current state of both toggle buttons.
CONCLUSION : This Android application effectively demonstrates the use of Toggle Buttons
to switch between two states (ON/OFF) and shows their current status through Toast messages.
This project helps in understanding the implementation of interactive UI elements in Android
applications.
AIM: To design a simple login page using both ConstraintLayout and LinearLayout in Android,
and to compare their usability and appearance.
CODE:
1. Using ConstraintLayout:
<!-- activity_main.xml -->
<androidx.constraintlayout.widget.ConstraintLayout
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">
<EditText
android:id="@+id/username"
android:layout_width="0dp"
android:layout_height="wrap_content"
Name/Signature: Mukul Choudhari
Registration no: 22BCE10410
android:hint="Username"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="100dp" />
<EditText
android:id="@+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="Password"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/username"
android:layout_marginTop="20dp" />
<Button
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/password"
android:layout_marginTop="30dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
// MainActivity.java
package com.example.loginpage;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Initialize UI components
usernameEditText = findViewById(R.id.username);
passwordEditText = findViewById(R.id.password);
loginButton = findViewById(R.id.login_button);
2. Using LinearLayout:
<!-- activity_main.xml -->
<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="16dp">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:layout_marginTop="20dp" />
<Button
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:layout_marginTop="30dp" />
</LinearLayout>
<!-- activity_main.xml (LinearLayout version) -->
<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="16dp">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:layout_marginTop="20dp" />
<Button
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:layout_marginTop="30dp" />
</LinearLayout>
DESCRIPTION: 1. ConstraintLayout: This layout allows for flexible positioning of views based on
constraints relative to each other. It helps create a responsive UI that adapts well to different screen sizes.
2. LinearLayout: This layout arranges child views either vertically or horizontally. In this case, we use
vertical orientation to stack the username and password fields on top of each other, providing a simple and
straightforward layout.
AIM: To design and implement an option Menu Bar in an Android application, where each menu
item displays a toast message upon selection. The menu should contain items for the user's name,
registration number, branch, and a semester option with sub-items for subjects.
CODE:
1. Create a new menu XML file (e.g., menu_main.xml) in the res/menu folder.
<!-- res/menu/menu_main.xml -->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<!-- First item: Name -->
<item
android:id="@+id/menu_name"
android:title="Your Name"/>
android:title="Your Branch"/>
<!-- Fourth item: Semester with sub-items for each subject -->
<item
android:id="@+id/menu_semester"
android:title="Semester">
<menu>
<item
android:id="@+id/menu_subject1"
android:title="Subject 1"/>
<item
android:id="@+id/menu_subject2"
android:title="Subject 2"/>
<item
android:id="@+id/menu_subject3"
android:title="Subject 3"/>
<!-- Add more subjects as needed -->
</menu>
</item>
</menu>
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_name:
Toast.makeText(this, "Your Name Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_reg_no:
Toast.makeText(this, "Registration Number Selected",
Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_branch:
Toast.makeText(this, "Branch Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_subject1:
Toast.makeText(this, "Subject 1 Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_subject2:
Toast.makeText(this, "Subject 2 Selected", Toast.LENGTH_SHORT).show();
return true;
case R.id.menu_subject3:
Toast.makeText(this, "Subject 3 Selected", Toast.LENGTH_SHORT).show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
DESCRIPTION: The application successfully displays a Menu Bar in the main activity with the
following items:
Name: Displays a toast saying "Your Name Selected."
Registration Number: Displays a toast saying "Registration Number Selected."
Branch: Displays a toast saying "Branch Selected."
Semester: Contains sub-items for different subjects, each displaying a corresponding toast (e.g.,
"Subject 1 Selected").
RESULT: The experiment resulted in a functional Menu Bar in the Android application. Each item and
sub-item displayed an appropriate toast message upon selection, confirming the successful implementation
of menu handling in Android.
OBSERVATION: 1. The Menu Bar was successfully displayed in the app, and each menu item
triggered its respective toast message.
2. Sub-items under the "Semester" menu were nested correctly and displayed specific toast
messages when selected.
3. The toast messages appeared briefly at the bottom of the screen, providing visual feedback to
the user on item selection.
CONCLUSION : The experiment demonstrates the creation of a dynamic Menu Bar in an
Android application and the implementation of toast messages to provide user feedback on menu
selections. This process illustrates the basics of handling menu item clicks in Android, essential
for creating interactive and responsive applications. The menu and toast feature adds to the user
experience by providing clear feedback on actions taken in the app.
Date: Title
AIM:
To create and implement a Context menu for Car info that includes information
like color,price,fuel type,mileage,model etc..
PROCEDURE:
● Create a simple layout with a TextView which will represent a car and will trigger the
context menu when long-clicked.
● In the activity's Java code, register the TextView for a context menu by calling
registerForContextMenu().
● Override the onCreateContextMenu() method to add the menu options for car details like
model, price, fuel type, color, and mileage.
● Assign each option a unique ID.
● Override the onContextItemSelected() method to capture the selection of the menu item
and display a toast message with the relevant car information based on the selected menu
option.
● Build and run the app, and test that the context menu works as expected, showing the
appropriate toast messages when each menu item is selected.
CODE:
DESCRIPTION:
In this implementation, the app consists of a simple user interface with a single TextView
element that represents the car. The core of the app lies in the creation and handling of a context
menu which appears when the user long-clicks on the TextView. The context menu provides
several options to view details about the car, such as:
● Model
● Price
● Fuel Type
● Color
● Mileage
When the user selects one of these options, a Toast message is displayed with the respective
information for the selected car detail. This creates an interactive experience for the user,
allowing them to learn more about the car without navigating away from the current screen.
RESULT:
● A user will be able to long-click on the TextView that represents the car.
● The context menu will appear with the available options: Model, Price, Fuel Type,
Color, and Mileage.
● Upon selecting any of the menu items, a toast message will appear, displaying the
corresponding information.
OBSERVATION:
The context menu appears correctly when the TextView is long-clicked.The menu
options display as expected and are clear to the user.The toast messages provide
the expected information when a menu item is selected.The context menu works as
a quick and intuitive way to access additional details without navigating through
other UI elements.
CONCLUSION :
The implementation of the context menu for displaying car information was
successful. By using the context menu in combination with toast messages, we
were able to create an easy-to- use interface where users can quickly access car
details such as model, price, fuel type, color, and mileage. This functionality
Name/Signature: Mukul Choudhari
Registration no: 22BCE10410
enhances the user experience by providing immediate feedback through the toast
messages and simplifies the interface by using the context menu.
AIM: To design and implement a simple mobile application with multiple pages, demonstrating
the concept of navigation between pages using a clickable image and a back button.
PROCEDURE: Procedure:
1. Set up the Development Environment:
o Create a new project and design the basic layout for the first page.
2. Design the First Page:
o Add a placeholder for the image on the first page.
o Set up an event listener for the image to trigger navigation to the second page when
clicked.
3. Design the Second Page:
o Add text views to display the name and registration number.
o Add a button to navigate back to the first page.
4. Implement Navigation Logic:
o Use appropriate navigation techniques (e.g., Intent in Android, NavigationController
in iOS) to switch between pages.
o Handle the back button press to return to the previous page.
5. Test and Debug:
o Run the app on a device or emulator to test the navigation functionality.
o Debug any issues and refine the user experience.
CODE:
DESCRIPTION:
The experiment involved the following steps:
1. Project Setup:
o A new mobile app project was created using a suitable development environment
(e.g., Android Studio, Xcode).
o The basic layout for both pages was designed.
2. Image Integration:
o The user's photo was added to the project resources.
o The image was displayed on the main page using an appropriate UI component (e.g.,
ImageView).
3. Navigation Implementation:
o An event listener was attached to the image to trigger navigation when clicked.
o An intent (Android) or navigation controller (iOS) was used to switch between the
Name/Signature: Mukul Choudhari
Registration no: 22BCE10410
OBSERVATION:
Clicking the image on the first page successfully navigates to the second page.
The second page displays the name and registration number.
Clicking the back button returns to the first page.
Exp. No: 09 Android application with four buttons: "Email," "VIT Bhopal Website,"
"Google MAP," and "My Camera,"
AIM: To create an Android application with four buttons: "Email," "VIT Bhopal Website,"
"Google MAP," and "My Camera," showcasing the use of explicit intents to navigate between
activities and open external apps.
PROCEDURE:
1. Set Up the Environment:
Install Android Studio and set up a new Android project.
2. Design the Layout:
Create four buttons in the main activity to handle the functionalities.
3. Handle Explicit Intents:
Email: Navigate to a new activity with a form to send an email.
VIT Bhopal Website: Open the website using an Intent with a browser URL.
Google MAP: Open Google Maps using an Intent.
My Camera: Launch the camera app using an Intent.
4. Test Functionality:
Run the app on an emulator or a physical device to ensure all buttons and intents work as
expected.
CODE:
OBSERVATION:
1. Clicking the "Email" button navigates to an email form, and the form sends an email
successfully.
2. Clicking the "VIT Bhopal Website" button opens the VIT Bhopal website in the default
browser.
3. Clicking the "Google MAP" button launches Google Maps centered on VIT Bhopal.
4. Clicking the "My Camera" button opens the device's camera app.
AIM: To develop an Android application that utilizes the proximity sensor to measure and display the
distance of an object from the sensor. The application will also provide tactile feedback (vibration) when
an object is in close proximity and display relevant data on the screen, including the sensor value, the
developer's name, and registration number.
1. PROCEDURE: Setup Development Environment: Install Android Studio and set up the necessary
SDK tools.
2. Create a New Project: Create a new Android project with an empty activity.
3. Configure Permissions: Add vibration permissions in the AndroidManifest.xml.
4. Setup UI:
o Use TextView to display sensor values and user details.
o Add a toast message when an object is close to the proximity sensor.
5. Access Proximity Sensor:
o Use the Android SensorManager to access the device’s proximity sensor.
o Implement a SensorEventListener to handle sensor value changes.
6. Implement Vibration:
o Trigger the vibration feedback using the Vibrator class when the sensor value indicates
close proximity.
7. Build and Run: Compile the application and test it on a physical Android device.
CODE
OBSERVATION: The sensor value decreases as an object comes closer to the proximity sensor.
The application effectively provides vibration feedback when an object is near.
The toast message ensures real-time feedback for the user.
CONCLUSION : The application successfully utilizes the proximity sensor to measure the distance of
an object, display the sensor value, and provide tactile feedback when an object is close. This
demonstrates the integration of hardware sensors and user interface elements in Android development.
AIM:
To implement and install the SQLite database in an Android application collecting user details as
the data.
1. Create a new empty file named dbcode.
2. Importing all the required libraries and bundles.
3. Create another java class for methods update, delete, insert,
View named as dbhelper.
4. Run the code.
PROCEDURE:
1.Create Database Helper Class (DatabaseHelper.java):
Code:
Description:
This project involves the creation of an Android application that interacts with an SQLite
database to perform basic CRUD (Create, Read, Update, Delete) operations for managing user
details. The application collects the following user information:
Name
Registration Number
Branch
1. Insert: Allows the user to enter their name, registration number, and branch and save
them in the database.
2. Update: Allows the user to modify an existing user's data in the database.
3. Delete: Allows the user to delete a specific user from the database.
4. View: Displays all the users stored in the SQLite database.
Result:
Insert Operation:
Upon entering user details (name, regno, branch) and clicking the Insert
button, the data was successfully inserted into the SQLite database.
A Toast message saying "User Inserted" appeared to confirm the successful
insertion.
After pressing the View button, the newly inserted user data was displayed
correctly in
the TextView.
Update Operation:
After entering new details (name, regno, branch) and pressing the Update button, the
data for the user with the hardcoded ID (ID = 1) was successfully updated.
A Toast message saying "User Updated" appeared to confirm the successful update.
Clicking the View button displayed the updated user data in the TextView.
Delete Operation:
After pressing the Delete button, the user with the specified ID (hardcoded
ID = 1) was deleted from the database.
A Toast message saying "User Deleted" appeared to confirm the successful
deletion.
Name: Mukul Choudhari
Registration no: 22BCE10410
0
After clicking the View button, the deleted user data no longer appeared in the
Text View, confirming the deletion.
View Operation:
Upon clicking the View button, all the stored user data was retrieved and
displayed in the Text View.
If the database was empty, the message "No data available" was displayed.
When users were available, their data (ID, Name, Reg No, Branch) was
displayed correctly, formatted as expected.
Observation:
Insert Operation:
The insert operation worked as expected, successfully adding user data to the
SQLite database.
The app correctly displayed a confirmation Toast message ("User Inserted") and
updated the View button's display to show the inserted data.
Update Operation:
The update operation correctly modified the existing user's data in the database.
The app updated the user information in the database, and after clicking View,
the updated data was shown as expected.
The "User Updated" Toast message appeared after the operation was complete.
Delete Operation:
The delete operation successfully removed the user with the specified ID from
the database.
After clicking View, the deleted user no longer appeared in the list, indicating the
deletion was successful.
The confirmation Toast message ("User Deleted") was displayed as expected.
View Operation:
The View button accurately displayed all user data stored in the SQLite database.
When the database was empty, the message "No data available" appeared,
ensuring the user was informed about the empty database state.
The Text View displayed user data in the correct format, confirming
the correct functioning of the SELECT SQL query.
Conclusion:
This project demonstrates how to integrate an SQLite database with an Android application to
manage user details. By implementing basic CRUD operations (Insert, Update, Delete, View),
we learned the following: