Android practicals

Mobile Application Development Practical 26

Mobile Application Development Practical 26 Question 1 Write a program to insert data in SQLite database using AsyncTask. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <TextView android:id="@+id/textView3" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:textSize="25dp" android:textStyle="bold" android:text="Student Form" /> <TextView android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Enter Name" android:layout_marginTop="70dp" android:layout_marginLeft="70dp" android:layout_below="@id/textView3"/> <EditText android:id="@+id/sname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:ems="10" android:layout_toRightOf="@id/textView4" […]

Mobile Application Development Practical 26 Read More »

Mobile Application Development Practical 24

Mobile Application Development Practical 24 Question 1 Write a program to turn on, get visible, list devices and turnoff Bluetooth with the help of following GUI. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="20dp" android:orientation="vertical" tools:context=".MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/heading" android:text="Bluetooth" android:textSize="40dp" android:textStyle="bold"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="Turn On" android:id="@+id/btnon" android:background="#A19A9A"/> <Button

Mobile Application Development Practical 24 Read More »

Mobile Application Development Practical 23

Mobile Application Development Practical 23 Question 1 Write a program to capture an image and display it using image view. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <ImageView android:id="@+id/imagev" android:layout_height="500dp" android:layout_width="match_parent"/> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Capture" android:layout_below="@id/imagev" android:layout_centerHorizontal="true"/> </RelativeLayout> AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <application android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher"

Mobile Application Development Practical 23 Read More »

Mobile Application Development Practical 22

Mobile Application Development Practical 22 Question 1 Write a program to display the list of sensors supported by the mobile device. 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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:text="List of sensors" android:textSize="20dp" /> <TextView android:id="@+id/textView2" android:layout_width="match_parent"

Mobile Application Development Practical 22 Read More »

Mobile Application Development Practical 21

Mobile Application Development Practical 21 Question 1 Write a program to demonstrate all the system broadcast messages. 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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <application android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.Practical21" tools:targetApi="31">

Mobile Application Development Practical 21 Read More »

Mobile Application Development Practical 18

Mobile Application Development Practical 18 Question 1 Write a program to create a text field and a button “Navigate”. When you enter “www.google.com” and press navigate button it should open google page. 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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/editText" android:layout_centerHorizontal="true" android:text="Nevigate" /> <EditText

Mobile Application Development Practical 18 Read More »

Mobile Application Development Practical 17

Mobile Application Development Practical 17 Question 1 Write a program to create a HelloWorld Activity using all lifecycles methods to display messages using Log.d. 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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Activity Life Cycle" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> MainActivity.java package com.example.practical17; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import

Mobile Application Development Practical 17 Read More »

Mobile Application Development Practical 16

Mobile Application Development Practical 16 Question 1 Write a program to display following output. Select and display date and time on click of buttons. 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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/edit1" android:layout_width="180dp" android:layout_marginLeft="40dp" android:layout_marginTop="100dp" android:layout_height="48dp" /> <EditText android:id="@+id/edit2" android:layout_width="180dp" android:layout_below="@id/edit1" android:layout_alignLeft="@id/edit1" android:layout_height="48dp" /> <Button android:id="@+id/button1" android:layout_width="wrap_content"

Mobile Application Development Practical 16 Read More »

Mobile Application Development Practical 15

Mobile Application Development Practical 15 Question 1 Write a program to display three checkboxes and one button as below. Once you click on the button it should display different checkboxes and total cost. 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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="150dp" android:layout_marginTop="70dp" android:text="Pizza"

Mobile Application Development Practical 15 Read More »

Mobile Application Development Practical 14

Mobile Application Development Practical 14 Question 1 Write a program to display following output. 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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <ListView android:id="@+id/lstv" android:layout_width="match_parent" android:layout_height="match_parent" android:divider="#8A8585" android:dividerHeight="1dp" android:listSelector="#F28DD8FA" /> </androidx.constraintlayout.widget.ConstraintLayout> activity_list.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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ListActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:id="@+id/listText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:textSize="20dp"

Mobile Application Development Practical 14 Read More »