0% found this document useful (0 votes)
25 views35 pages

Mad All Programs

The document describes an Android program to demonstrate a GridView. It includes the XML layout code to create a GridView and populate it with string items. It also includes the Java code to get a reference to the GridView, create an ArrayAdapter and set it on the GridView.

Uploaded by

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

Mad All Programs

The document describes an Android program to demonstrate a GridView. It includes the XML layout code to create a GridView and populate it with string items. It also includes the Java code to get a reference to the GridView, create an ArrayAdapter and set it on the GridView.

Uploaded by

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

Program to demonstrate GridView.

XML CODE:

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">

<GridView
android:id="@+id/gridview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numColumns="3"
android:stretchMode="columnWidth"
android:verticalSpacing="20dp"
android:horizontalSpacing="10dp"
android:layout_gravity="center"/>

</LinearLayout>

JAVA CODE:

package com.example.pranu1;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


GridView gd;
String[]arr = {"Item 1", "Item 2", "Item 3", "Item 4","Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10"};

@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gd = findViewById(R.id.gridview);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, arr);
gd.setAdapter(adapter);
gd.setOnItemClickListener((parent, view, position, id) -> {
String msg = arr[position]+" is selected";
Toast.makeText(MainActivity.this,msg,Toast.LENGTH_LONG).show();
});
}
}
❖ TextToSpeech conversion program.
XML CODE:-

<?xml version="1.0" encoding="utf-8"?> android:layout_gravity="center_horizontal"


<LinearLayout android:paddingTop="100dp"
xmlns:android="http://schemas.android.com/apk/res/ android:textSize="20dp"
android" android:hint="Enter Text you want to Read out
xmlns:tools="http://schemas.android.com/tools" loud"/>
android:layout_width="match_parent"
android:layout_height="match_parent" <Button
tools:context=".MainActivity" android:layout_width="wrap_content"
android:orientation="vertical"> android:layout_height="wrap_content"
android:id="@+id/BT"
<EditText android:text="Submit"
android:layout_width="wrap_content" android:layout_gravity="center_horizontal"/>
android:layout_height="wrap_content" </LinearLayout>
android:id="@+id/ET"

JAVA CODE:-

package com.example.pranu1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import java.util.Locale;

public class MainActivity extends AppCompatActivity {


EditText et;
Button btn;
TextToSpeech tt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et = findViewById(R.id.ET);
btn = findViewById(R.id.BT);

tt = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {


@Override
public void onInit(int status) {
if(status != TextToSpeech.ERROR){
tt.setLanguage(Locale.UK);
}
}
});

btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tt.speak(et.getText().toString(),TextToSpeech.QUEUE_FLUSH,null);
}
});
}
}
❖ Time picker and Date picker Program.
XML CODE:-
<?xml version="1.0" encoding="utf-8"?> android:layout_height="wrap_content"
<LinearLayout android:layout_gravity="center_horizontal"
xmlns:android="http://schemas.android.com/apk/res/ android:text="Set Date" />
android"
xmlns:tools="http://schemas.android.com/tools" <TimePicker
android:layout_width="match_parent" android:id="@+id/timepcker"
android:layout_height="match_parent" android:layout_width="match_parent"
tools:context=".MainActivity" android:layout_height="wrap_content"
android:orientation="vertical"> android:timePickerMode="spinner"/>

<DatePicker <TextView
android:id="@+id/dtpcker" android:id="@+id/tvTime"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:datePickerMode="spinner"/> android:layout_gravity="center_horizontal"
android:textSize="20dp"
<TextView android:textStyle="bold" />
android:id="@+id/tvDate"
android:layout_width="wrap_content" <Button
android:layout_height="wrap_content" android:id="@+id/btnTime"
android:layout_gravity="center_horizontal" android:layout_width="wrap_content"
android:textSize="20dp" android:layout_height="wrap_content"
android:textStyle="bold" /> android:layout_gravity="center_horizontal"
android:text="Set Time"/>
<Button
android:id="@+id/btnDate" </LinearLayout>
android:layout_width="wrap_content"

JAVA CODE:

package com.example.pranu1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
import android.widget.TimePicker;
public class MainActivity extends AppCompatActivity {
TextView tvDate, tvTime;
DatePicker dtpcker;
TimePicker timepcker;
Button b1, b2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvDate = findViewById(R.id.tvDate);
tvTime = findViewById(R.id.tvTime);
b1 = findViewById(R.id.btnDate);
b2 = findViewById(R.id.btnTime);
dtpcker = findViewById(R.id.dtpcker);
timepcker = findViewById(R.id.timepcker);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tvDate.setText("Date: "+dtpcker.getDayOfMonth()+"/"+dtpcker.getMonth()+"/"+dtpcker.getYear());
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tvTime.setText(timepcker.getHour()+":"+timepcker.getMinute());
}
});
}
}

❖ Develop an android application to show current location of an user'scar.


activity_maps.xml
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="example.com.mapexample.MapsActivity" />

AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />

Java code:

import android.os.Build;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.*;
import android.location.Location;
import android.Manifest;
import android.content.pm.PackageManager;
❖ Design an Database Program.
XML CODE:-

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">

<TextView <EditText
android:layout_width="wrap_content" android:layout_width="268dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/T1" android:id="@+id/Et4"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:text="Employee Regestration Form" android:paddingTop="20dp"
android:textSize="24dp" android:hint="Enter you Address"/>
android:textStyle="bold"
android:paddingTop="40dp" <EditText
android:paddingBottom="40dp"/> android:layout_width="268dp"
android:layout_height="wrap_content"
<EditText android:id="@+id/Et5"
android:id="@+id/Et1" android:layout_gravity="center_horizontal"
android:layout_width="268dp" android:paddingTop="20dp"
android:layout_height="wrap_content" android:hint="Enter you pin code"
android:layout_gravity="center_horizontal" android:paddingBottom="20dp"/>
android:hint="Enter your Id " />
<Button
<EditText android:layout_width="wrap_content"
android:layout_width="268dp" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:id="@+id/Btn"
android:id="@+id/Et2" android:layout_gravity="center_horizontal"
android:layout_gravity="center_horizontal" android:text="Submit"/>
android:paddingTop="20dp"
android:hint="Enter your name"/> </LinearLayout>

<EditText
android:layout_width="268dp"
android:layout_height="wrap_content"
android:id="@+id/Et3"
android:layout_gravity="center_horizontal"
android:paddingTop="20dp"
android:hint="Enter your mobile no."/>
JAVA Code:

package com.example.db;
import android.database.Cursor;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import androidx.appcompat.app.AlertDialog;

public class MainActivity extends AppCompatActivity {

Button add,modify,delete,view;
EditText e,e1,e2,e3;
SQLiteDatabase db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
add = findViewById(R.id.button);
modify = findViewById(R.id.button2);
delete = findViewById(R.id.button3);
view = findViewById(R.id.button4);
e = findViewById(R.id.et);
e1 = findViewById(R.id.et2);
e2 = findViewById(R.id.et3);
e3 = findViewById(R.id.et4);
db = openOrCreateDatabase("Student",Context.MODE_PRIVATE,null);
db.execSQL("CREATE TABLE IF NOT EXISTS student(rollno INTEGER, name VARCHAR, subject
VARCHAR, feedback VARCHAR);");

add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (e.getText().toString().trim().length() == 0) {
showmessage("Error","Please Enter your Roll no");
return;
}
db.execSQL("INSERT INTO student VALUES('" + e.getText() + "', '" + e1.getText() + "', '" + e2.getText() +
"', '" + e3.getText() + "');");
showmessage("Success","DATA added");
clear();
}
});

modify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (e.getText().toString().trim().length() == 0) {
showmessage("Error","Please Enter your Roll no");
return;
}
Cursor c = db.rawQuery("SELECT * FROM student WHERE rollno ='"+ e.getText() +"'",null);
if (c.moveToFirst()){
db.execSQL("UPDATE student SET name = '" + e1.getText() + "',subject = '" + e2.getText() + "',feedback
= '" + e3.getText() + "' WHERE rollno = '"+ e.getText() +"'");
showmessage("Success", "Modified Successfully");
}else {
showmessage("Error","Invalid Roll no");
}
clear();
}
});

delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (e.getText().toString().trim().length() == 0) {
showmessage("Error","Please Enter your Roll no");
return;
}
Cursor c = db.rawQuery("SELECT * FROM student WHERE rollno ='"+ e.getText() +"'",null);
if (c.moveToFirst()){
db.execSQL("DELETE FROM student WHERE rollno = '"+ e.getText() +"'");
showmessage("Success", "Deleted Successfully");
}else {
showmessage("Error","Invalid Roll no");
}
clear();
}
});

view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (e.getText().toString().trim().length() == 0) {
showmessage("Error","Please Enter your Roll no");
return;
}
Cursor c = db.rawQuery("SELECT * FROM student WHERE rollno ='"+ e.getText() +"'",null);
if (c.moveToFirst()){
e1.setText(c.getString(1));
e2.setText(c.getString(2));
e3.setText(c.getString(3));
}else {
showmessage("Error","Invalid Roll no");
}
clear();
}
});
}

public void showmessage(String title,String message){


AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}

public void clear(){


e.setText("");
e1.setText("");
e2.setText("");
e3.setText("");
}
}
❖ Design an android application to show the list of paired devices byBluetooth.
XML CODE:-

<LinearLayout android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="match_parent" android:id="@+id/tv"
tools:context=".MainActivity" android:text="Paired devices"
android:orientation="vertical"> android:layout_gravity="center_horizontal"
android:textSize="25dp"
<Button android:textStyle="bold"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content" <ListView
android:layout_gravity="center_horizontal" android:layout_width="wrap_content"
android:id="@+id/btn" android:layout_height="wrap_content"
android:text="List all paired Devices" android:id="@+id/Lv"/>
android:onClick="list"/>
</LinearLayout>
<TextView

JAVA CODE:-
package com.example.pranu1;
import androidx.appcompat.app.AppCompatActivity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Set;

public class MainActivity extends AppCompatActivity {

Button btn;
ListView lv;
BluetoothAdapter ba;
Set<BluetoothDevice> pairedDevice;
ArrayList<String> list = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lv = findViewById(R.id.Lv);
btn = findViewById(R.id.btn);
ba = BluetoothAdapter.getDefaultAdapter();
}
public void list(){
pairedDevice = ba.getBondedDevices();
for(BluetoothDevice bt: pairedDevice)
list.add(bt.getName());
Toast.makeText(getApplicationContext(),"Showing Paired Devices",Toast.LENGTH_LONG).show();
ArrayAdapter<String>ad = new ArrayAdapter(this, android.R.layout.simple_list_item_1,list);
lv.setAdapter(ad);
}
}
❖ Sending SMS
Manifest file permissions:

<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<uses-permission android:name="android.permission.SEND_SMS"/>

XML FILE:-

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="To,"
android:textSize="24dp"/>

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter Recievers Number"
android:textSize="24dp"
android:id="@+id/et1"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter the Message below"
android:textSize="24dp"/>

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter message here"
android:textSize="24dp"
android:id="@+id/et2"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn"
android:text="SEND"
android:layout_gravity="center_horizontal"/>

</LinearLayout>
JAVA CODE:-

package com.example.pranu1;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


private EditText etno;
private EditText etmsg;
private Button btn;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etno = findViewById(R.id.et1);
etmsg = findViewById(R.id.et2);
btn = findViewById(R.id.btn);
if(ContextCompat.checkSelfPermission(MainActivity.this,Manifest.permission.SEND_SMS)!=PackageManaer.
PERMISSION_GRANTED)
{
ActivityCompat.requestPermissions(MainActivity.this,new String[]{Manifest.permission.SEND_SMS},100);
}

btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
SmsManager smsgr = SmsManager.getDefault();
smsgr.sendTextMessage(etno.getText().toString(), null, etmsg.getText().toString(), null, null);
Toast.makeText(MainActivity.this, "SMS sent successfully", Toast.LENGTH_LONG).show();
}catch(Exception e){
Toast.makeText(MainActivity.this,"SMS failed, try again later", Toast.LENGTH_LONG).show();
}
}
});
}
}
Absolute Layout. (UI )
XML CODE:-

<AbsoluteLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<TextView
android:layout_x="80dp"
android:layout_y="80dp"
android:text="User Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_x="80dp"
android:layout_y="100dp"
android:width="100px" />

<TextView
android:layout_x="80dp"
android:layout_y="180dp"
android:text="Password"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_x="80dp"
android:layout_y="200dp"
android:width="100px" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="150dp"
android:layout_y="300dp"
android:text="Log In" />

</AbsoluteLayout>
❖ Write a program to convert temperature from Celsius to Fahrenheit and vice
versa using Toggle button. (Design UI as per your choice. Write XML andjava
file).
XML CODE:-

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity"
android:orientation="vertical">

<EditText
android:id="@+id/et1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter the temperature"
android:inputType="numberDecimal"/>

<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tb"
android:textOff="F to C"
android:textOn="C to F" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Toogle button"
android:id="@+id/bt"/>

</LinearLayout>
JAVA CODE:-

package com.example.pranu1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.widget.ToggleButton;

public class MainActivity extends AppCompatActivity {


ToggleButton tb;
EditText temp;
Button btn;
double a, b;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tb = findViewById(R.id.tb);
temp = findViewById(R.id.et1);
btn = findViewById(R.id.bt);

btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a = Double.parseDouble(String.valueOf(temp.getText()));
if(tb.isChecked()){
b = a*9/5+32;
String r = String.valueOf(b);
Toast.makeText(MainActivity.this,r+" F",Toast.LENGTH_LONG).show();
}else{
b = a - 32;
b = b*5/9;
String r = String.valueOf(b);
Toast.makeText(MainActivity.this,r+" C",Toast.LENGTH_LONG).show();
}
}
});
}
}
❖ Write a program to capture an image using camera and display it.
XML CODE:-

<LinearLayout android:layout_height="500dp"
xmlns:android="http://schemas.android.com/apk/res/ android:id="@+id/iv"/>
android"
android:layout_width="match_parent" <Button
android:layout_height="match_parent" android:layout_width="wrap_content"
xmlns:tools="http://schemas.android.com/tools" android:layout_height="wrap_content"
tools:context=".MainActivity" android:text="Take Photo"
android:orientation="vertical"> android:id="@+id/btn"
android:layout_gravity="center_horizontal"/>
<ImageView
android:layout_width="match_parent" </LinearLayout>

JAVA CODE:-

package com.example.pranu1;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {

Button btn;
ImageView iv;
private static final int cr = 123;

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

btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i,cr);
}
});
}

public void onActivityResult(int reqC, int resC, Intent data){


super.onActivityResult(reqC, resC, data);
if(resC == cr){
Bitmap img = (Bitmap)data.getExtras().get("data");
iv.setImageBitmap(img);
}
}
}
❖ Develop and application to send and receive SMS.
Manifest file:-

<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.WRITE_SMS"/>

<receiver
android:name=".SmsReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>

XML CODE:-

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity"
android:orientation="vertical">

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="To (Enter recievers phone number)"
android:id="@+id/et1"
android:textSize="24dp"/>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Text message here"
android:id="@+id/et2"
android:textSize="24dp"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send"
android:id="@+id/btn"
android:layout_gravity="center_horizontal"/>

</LinearLayout>
MainActivity.java

package com.example.pranu1;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.content.IntentFilter;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.telephony.SmsManager;
import android.widget.Toast;
import androidx.core.content.ContextCompat;
import android.Manifest;
import android.content.pm.PackageManager;
import androidx.core.app.ActivityCompat;

public class MainActivity extends AppCompatActivity {


SmsReciever sms = new SmsReciever();
EditText e1,e2;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
e1 = findViewById(R.id.editTextText);
e2 = findViewById(R.id.editTextText2);
btn = findViewById(R.id.button);
if(ContextCompat.checkSelfPermission(MainActivity.this,Manifest.permission.SEND_SMS)!=
PackageManager.PERMISSION_GRANTED)
{
ActivityCompat.requestPermissions(MainActivity.this,new
String[]{Manifest.permission.SEND_SMS},100);
}
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String phno = e1.getText().toString();
String msg = e2.getText().toString();
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phno,null,msg,null,null);
Toast.makeText(MainActivity.this, "Sms Sent Successfully", Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void onStart(){
super.onStart();;
IntentFilter filter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
registerReceiver(sms,filter);
}
@Override
protected void onStop(){
super.onStop();
unregisterReceiver(sms);
}
}
SmsReciever.java

package com.example.pranu1;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.Context;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;

public class SmsReciever extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {

Bundle bundle = intent.getExtras();


Object[] smsObj = (Object[]) bundle.get("pdus");

for (Object obj : smsObj){


SmsMessage message = SmsMessage.createFromPdu((byte[]) obj);

String mob = message.getDisplayOriginatingAddress();


String msg = message.getMessageBody();

Log.d("Messages Details:", "Mobile no"+ mob+ ",Message "+msg);


}
}
}
❖ Android lifecycle methods using Toast message.
package com.example.pranu1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

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

Toast.makeText(getApplicationContext(),"Activity Created",Toast.LENGTH_LONG).show();
}

@Override
protected void onStart(){
super.onStart();
Toast.makeText(getApplicationContext(),"Activity Started",Toast.LENGTH_LONG).show();
}

@Override
protected void onStop(){
super.onStop();
Toast.makeText(getApplicationContext(),"Activity Stopped",Toast.LENGTH_LONG).show();
}

protected void onRestart() {


super.onRestart();
Toast.makeText(getApplicationContext(),"Activity Restarted",Toast.LENGTH_LONG).show();
}

protected void onDestroy(){


super.onDestroy();
Toast.makeText(getApplicationContext(),"Activity Destroyed",Toast.LENGTH_LONG).show();
}

protected void onPause(){


super.onPause();
Toast.makeText(getApplicationContext(),"Activity Paused",Toast.LENGTH_LONG).show();
}

protected void onResume(){


super.onResume();
Toast.makeText(getApplicationContext(),"Activity Resumed",Toast.LENGTH_LONG).show();
}
}
❖ Design UI using table layout to display buttons with 0 9 numbers on it. Even
display submit and clear button. When user clicks on particular buttons and
later when clicks on submit button, it should display the numbers clicked.
XML CODE:-

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">

<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt1"
android:text="0"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt2"
android:text="1"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt3"
android:text="2"/>

</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt4"
android:text="3"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt5"
android:text="4"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt6"
android:text="5"/>

</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt7"
android:text="6"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt8"
android:text="7"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt9"
android:text="8"/>

</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bt10"
android:text="9"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/submit"
android:text="SUBMIT"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/clear"
android:text="CLEAR"/>

</TableRow>

</TableLayout>
JAVA CODE:-

package com.example.pranu1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {


Button b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,sub,clr;
String a=null;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1 = findViewById(R.id.bt1);
b2 = findViewById(R.id.bt2);
b3 = findViewById(R.id.bt3);
b4 = findViewById(R.id.bt4);
b5 = findViewById(R.id.bt5);
b6 = findViewById(R.id.bt6);
b7 = findViewById(R.id.bt7);
b8 = findViewById(R.id.bt8);
b9 = findViewById(R.id.bt9);
b10 = findViewById(R.id.bt10);
sub = findViewById(R.id.submit);
clr = findViewById(R.id.clear);

b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b1.getText().toString();
}
});

b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b2.getText().toString();
}
});

b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b3.getText().toString();
}
});

b4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b4.getText().toString();
}
});
b5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b5.getText().toString();
}
});

b6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b6.getText().toString();
}
});

b7.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b7.getText().toString();
}
});

b8.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b8.getText().toString();
}
});

b9.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b9.getText().toString();
}
});

b10.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a= b10.getText().toString();
}
});

sub.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(),a,Toast.LENGTH_LONG).show();
}
});
}
}
Write an XML file to create login page using Table Layout.
XML CODE:
<TableLayout android:layout_width="281dp"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="match_parent" android:hint="Enter username" />
tools:context=".MainActivity"> </TableRow>

<TableRow <TableRow>
android:gravity="center_horizontal"> <TextView
android:layout_height="wrap_content"
<TextView android:layout_width="wrap_content"
android:id="@+id/t1" android:text="Password:"
android:layout_width="wrap_content" android:textSize="20sp"/>
android:layout_height="wrap_content"
android:text="LOGIN FORM" <EditText
android:textSize="24sp" android:layout_height="wrap_content"
android:textStyle="bold"/> android:layout_width="wrap_content"
android:id="@+id/et2"
</TableRow> android:hint="Enter Password"/>
</TableRow>
<TableRow>
<TextView <TableRow
android:layout_width="wrap_content" android:gravity="center_horizontal">
android:layout_height="wrap_content" <Button
android:id="@+id/t2" android:id="@+id/btn"
android:text="Username:" android:text="LOGIN" />
android:textSize="20sp" /> </TableRow>

<EditText </TableLayout
android:id="@+id/et1"
Develop an android application using Radio Button.
XML CODE:-

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male"
android:id="@+id/rb1"/>

<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female"
android:id="@+id/rb2"/>
</RadioGroup>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:id="@+id/btn"/>

</LinearLayout>

JAVA CODE:-

package com.example.p2;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


RadioButton r1, r2;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
r1 = findViewById(R.id.rb1);
r2 = findViewById(R.id.rb2);
btn = findViewById(R.id.btn);

btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(r1.isChecked()){
Toast.makeText(MainActivity.this,"Male is Selected",Toast.LENGTH_LONG).show();
}else{
Toast.makeText(MainActivity.this,"Female is Selected",Toast.LENGTH_LONG).show();

}
}
});
}
}
❖ Develop a program to perform addition, subtraction, division,
multiplication of two numbers and display the result. (Use appropriate
UIcontrols).
XML CODE:-

<LinearLayout android:layout_height="wrap_content"
android:layout_width="match_parent" android:text="Subtraction"
android:layout_height="match_parent" android:id="@+id/bt2"
android:orientation="vertical"
tools:context=".MainActivity"> android:layout_gravity="center_horizontal"/>

<EditText <Button
android:id="@+id/et1" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:text="Muliplication"
android:hint="Enter Number 1" android:id="@+id/bt3"

android:layout_gravity="center_horizontal"/> android:layout_gravity="center_horizontal"/>

<EditText <Button
android:id="@+id/et2" android:id="@+id/bt4"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter number 2" android:text="Divison"

android:layout_gravity="center_horizontal"/> android:layout_gravity="center_horizontal"/>

<Button <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Addition" android:layout_marginTop="35dp"
android:id="@+id/bt1" android:textSize="30dp"
android:id="@+id/tv"
android:layout_gravity="center_horizontal"/>
android:layout_gravity="center_horizontal"/>
<Button
android:layout_width="wrap_content" </LinearLayout>

JAVA CODE:-

package com.example.p2;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {


TextView tv;
Button ad, sb, ml, dv;
EditText et1, et2;
double result;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv = findViewById(R.id.tv);
et1 = findViewById(R.id.et1);
et2 = findViewById(R.id.et2);
ad = findViewById(R.id.bt1);
sb = findViewById(R.id.bt2);
ml = findViewById(R.id.bt3);
dv = findViewById(R.id.bt4);

ad.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
double num1 = Double.parseDouble(et1.getText().toString());
double num2 = Double.parseDouble(et2.getText().toString());
result = num1 + num2;
tv.setText(Double.toString(result));
}
});

sb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
double num1 = Double.parseDouble(et1.getText().toString());
double num2 = Double.parseDouble(et2.getText().toString());
result = num1 - num2;
tv.setText(Double.toString(result));
}
});

ml.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
double num1 = Double.parseDouble(et1.getText().toString());
double num2 = Double.parseDouble(et2.getText().toString());
result = num1 * num2;
tv.setText(Double.toString(result));
}
});

dv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
double num1 = Double.parseDouble(et1.getText().toString());
double num2 = Double.parseDouble(et2.getText().toString());
result = num1/num2;
tv.setText(Double.toString(result));
}
});
}
}
❖ Develop a program to TURN ON and OFF Bluetooth.
Manifest File:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

Java file:
package com.example.bluetooth;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.bluetooth.BluetoothAdapter;

public class MainActivity extends AppCompatActivity {


Button b1,b2,b3;
BluetoothAdapter BA;
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1 = findViewById(R.id.button);
b3 = findViewById(R.id.button3);
BA = BluetoothAdapter.getDefaultAdapter();

b1.setOnClickListener(new View.OnClickListener() {
@SuppressLint("MissingPermission")
@Override
public void onClick(View v) {
if (BA.isEnabled()){
Intent turnon = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(turnon,0);
Toast.makeText(getApplicationContext(),"Turned On",Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(), "Already ON", Toast.LENGTH_SHORT).show();
}
}
});

b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!BA.isEnabled()){
Toast.makeText(getApplicationContext(),"Turned Off",Toast.LENGTH_LONG).show();
}
}
});
}
}
WAP to display a rectangular progress bar.
XML CODE:-

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:id="@+id/pg"
android:min="0"
android:max="100"
style="@android:style/Widget.ProgressBar.Horizontal"
android:progress="2"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tv"
android:layout_marginTop="20dp"
android:textSize="30dp"
android:textStyle="bold"/>

</LinearLayout>

JAVA CODE:-

package com.example.p2;
import android.os.Bundle;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.os.Handler;
import android.os.Looper;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {


private ProgressBar p;
private int pgStatus = 0;
private TextView tv;

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

p = findViewById(R.id.pg);
tv = findViewById(R.id.tv);

new Thread(new Runnable() {


public void run() {
while (pgStatus < 100) {
pgStatus += 1;
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
p.setProgress(pgStatus);
tv.setText(pgStatus + "/" + p.getMax());
}
});
try {
// Sleep for 200 milliseconds.
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
}
To send and receive an email.
XML CODE:-

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Recievers Email"
android:id="@+id/et1"/>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Subject of email"
android:id="@+id/et2"/>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et3"
android:hint="Enter your emails body"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Send"
android:id="@+id/btn"/>

</LinearLayout>

JAVA CODE:-

*Sending part

package com.example.p2;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {


Button b1;
EditText et1, et2, et3;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1 = findViewById(R.id.btn);
et1 = findViewById(R.id.et1);
et2 = findViewById(R.id.et2);
et3 = findViewById(R.id.et3);

b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{et1.getText().toString()});
intent.putExtra(Intent.EXTRA_SUBJECT, new String[]{et2.getText().toString()});
intent.putExtra(Intent.EXTRA_TEXT, new String[]{et2.getText().toString()});
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent,"Choose mail app"));
}
});
}
}

*Receiving part

package com.example.p2;
import android.content.IntentFilter;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {


GmailReciever gml;
IntentFilter inf;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gml = new GmailReciever();
inf = new IntentFilter("android.intent.action.VIEW");
}

@Override
protected void onResume(){
super.onResume();
registerReceiver(gml,inf);
}
@Override
protected void onDestroy(){
super.onDestroy();
unregisterReceiver(gml);
}
}
*GmailReciever.java

package com.example.p2;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class GmailReciever extends BroadcastReceiver {


@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context,"Email Recieved!!",Toast.LENGTH_LONG).show();
}
}

MANIFEST FILE (ONLY IMPT PART)

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.gm.permission.READ_GMAIL"/>

<receiver android:name="GmailReceiver"
android:exported="false"
tools:ignore="WrongManifestParent">
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED"
android:priority="-10"/>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="content" android:host="gmail-ls"
android:pathPattern="/unread/.*"/>
</intent-filter>
</receiver>
❖ Develop a program to implement the following.
i) ListView of 5 items.
ii) GridView of 4x4 items.
iii) Image View.
XML CODE:-

<LinearLayout android:layout_height="300dp"
android:layout_width="match_parent" android:id="@+id/gv"
android:layout_height="match_parent" android:numColumns="4"
android:orientation="vertical" android:gravity="center"/>
tools:context=".MainActivity">
<ImageView
<ListView android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="300dp" android:id="@+id/iv"
android:id="@+id/lv"/> android:src="@drawable/img_4"/>

<GridView </LinearLayout>
android:layout_width="match_parent"
JAVA CODE:-

package com.example.p2;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ListView;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {


ListView lv;
GridView gd;
ImageView iv;
String[] alpha = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L","M","N","O","P"};
String [] arr = {"Apple", "Mango", "Banana", "Litchi", "Papaya", "Ice Apple"};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lv = findViewById(R.id.lv);
gd = findViewById(R.id.gv);
iv = findViewById(R.id.iv);

ArrayAdapter<String> ap = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,arr);


lv.setAdapter(ap);

ArrayAdapter<String> ap1 = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,alpha);


gd.setAdapter(ap1);
}
}

You might also like