Mad Lab Record
Mad Lab Record
1
(A CHRISITIAN MINORITY INSTITUTION)
JAISAKTHI EDUCATIONAL TRUST
ACCREDITED BY NATIONAL BOARD OF ACCREDITATION (NBA)
2
PANIMALAR ENGINEERING COLLEGE
(A CHRISITIAN MINORITY INSTITUTION)
JAISAKTHI EDUCATIONAL TRUST
ACCREDITED BY NATIONAL BOARD OF ACCREDITATION - NBA, NEW DELHI
Bangalore Trunk Road, Varadharajapuram, Nazarathpettai,
Poonamallee, Chennai – 600 123
BONAFIDE CERTIFICATE
This is a Certified Bonafide Record Book of
- 2021.
Staff – In charge
3
INDEX
Ex Page
Date Title Marks Sign
No No
Develop an Application that uses GUI Components, Font and
01. 20/2/21 1
Colours.
Develop an Application that uses Layout Managers and Event
02. 27/2/21 10
Listeners.
Write an Application that Draws Basic Graphical Primitives
03. 06/3/21 15
on the Screen.
10. 24/4/21 Write a Mobile Application that makes use of RSS Feed. 50
ADDITIONAL EXPERIMENTS
4
PANIMALAR ENGINEERING COLLEGE
AIM
To develop a Simple Android Application that uses GUI components, Font and Colors.
PROCEDURE
1
PANIMALAR ENGINEERING COLLEGE
Then select the Minimum SDK as shown below and click Next.
4
PANIMALAR ENGINEERING COLLEGE
Then delete the code which is there and type the code as given below.
Activity_main.xml:
Now click on Design and your application will look as given below.
5
PANIMALAR ENGINEERING COLLEGE
Then delete the code which is there and type the code as given below.
PROGRAM
MainActivity.java:
package com.example.exno1;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity
{
int ch=1;
float font=30;
6
PANIMALAR ENGINEERING COLLEGE
7
PANIMALAR ENGINEERING COLLEGE
8
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application that uses GUI Components, Font and Colours is
done using java with Android Studio and output is verified successfully.
Date: 27/2/21 MOBILE APPLICATIONS USING
9
PANIMALAR ENGINEERING COLLEGE
AIM
To develop a Simple Android Application that uses Layout Managers and Event Listeners.
PROCEDURE
Creating a New project:
Open Android Studio and then click on File -> New -> New project.
Then select the Minimum SDK as shown below and click Next.
10
PANIMALAR ENGINEERING COLLEGE
PROGRAM
Main Activity.java: (Click on app -> java -> com.example.exno2 -> MainActivity.)
package com.example.exno2;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
public class MainActivity extends AppCompatActivity {
11
PANIMALAR ENGINEERING COLLEGE
Second Activity.java: (Click on app -> java -> com.example.exno2 -> SecondActivity.)
package com.example.exno2;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class SecondActivity extends AppCompatActivity
{
TextView t1,t2,t3;
String name,reg,dept;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
t1= (TextView) findViewById(R.id.textView1);
t2= (TextView) findViewById(R.id.textView2);
t3= (TextView) findViewById(R.id.textView3);
//Getting the Intent
Intent i = getIntent();
//Getting the Values from First Activity using the Intent received
name=i.getStringExtra("name_key");
reg=i.getStringExtra("reg_key");
dept=i.getStringExtra("dept_key");
//Setting the Values to Intent
t1.setText(name);
13
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application that uses Layout Mangers and Event
Listeners is done using java with Android Studio and output is verified successfully.
Date: 06/3/21 MOBILE APPLICATIONS USING
Ex. No: 03 BASIC GRAPHICAL PRIMITIVES ON THE SCREEN
14
PANIMALAR ENGINEERING COLLEGE
PROCEDURE
Creating a New project:
Open Android Studio and then click on File -> New -> New project.
Then select the Minimum SDK as shown below and click Next.
15
PANIMALAR ENGINEERING COLLEGE
PROGRAM
MainActivity.java:
package com.example.exno3;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.widget.ImageView;
public class MainActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Creating a Bitmap
Bitmap bg = Bitmap.createBitmap(720, 1280, Bitmap.Config.ARGB_8888);
//Setting the Bitmap as background for the ImageView
ImageView i = (ImageView) findViewById(R.id.imageView);
i.setBackgroundDrawable(new BitmapDrawable(bg));
i.setImageDrawable(null);
//Creating the Canvas Object
Canvas canvas = new Canvas(bg);
//Creating the Paint Object and set its color & TextSize
Paint paint = new Paint();
paint.setColor(Color.BLUE);
paint.setTextSize(50);
//To draw a Rectangle
canvas.drawText("Rectangle", 420, 150, paint);
canvas.drawRect(400, 200, 650, 700, paint);
16
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application that draws Basic Graphical Primitives on the Screen
is done using Java with Android Studio and output is verified successfully.
Date: 13/3/21
MOBILE APPLICATIONS DATABASE
Ex. No: 04
17
PANIMALAR ENGINEERING COLLEGE
PROCEDURE
Open Android Studio and then click on File -> New -> New project.
Then select the Minimum SDK as shown below and click Next.
PROGRAM
18
PANIMALAR ENGINEERING COLLEGE
import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity implements OnClickListener
{EditText Rollno,Name,Mark
Button Insert,Delete,Update,View,ViewAll
SQLiteDatabase db;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Rollno=(EditText)findViewById(R.id.Rollno);
Name=(EditText)findViewById(R.id.Name);
Marks=(EditText)findViewById(R.id.Marks);
Insert=(Button)findViewById(R.id.Insert);
Delete=(Button)findViewById(R.id.Delete);
Update=(Button)findViewById(R.id.Update);
View=(Button)findViewById(R.id.View);
ViewAll=(Button)findViewById(R.id.ViewAll);
Insert.setOnClickListener(this);
Delete.setOnClickListener(this);
Update.setOnClickListener(this);
View.setOnClickListener(this);
ViewAll.setOnClickListener(this);
if(Rollno.getText().toString().trim().length()==0)
{
showMessage("Error", "Please enter Rollno");
return;
}
Cursor c=db.rawQuery("SELECT * FROM student WHERE rollno='"+Rollno.getText()+"'",
null);
if(c.moveToFirst())
{
db.execSQL("DELETE FROM student WHERE rollno='"+Rollno.getText()+"'");
showMessage("Success", "Record Deleted");
}
else
{
showMessage("Error", "Invalid Rollno");
}
clearText();
}
// Updating a record in the Student table
if(view==Update)
{
if(Rollno.getText().toString().trim().length()==0)
{
showMessage("Error", "Please enter Rollno");
20
PANIMALAR ENGINEERING COLLEGE
OUTPUT
22
PANIMALAR ENGINEERING COLLEGE
23
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application that makes use of Databases is done using Java with
Android Studio and output is verified successfully.
Date: 20/3/21 MOBILE APPLICATIONS USING NOTIFICATION MANAGER
24
PANIMALAR ENGINEERING COLLEGE
AIM
To develop a android application that makes use of notification manager.
PROCEDURE
Creating a New project:
Open Android Studio and then click on File -> New -> New project.
Then select the Minimum SDK as shown below and click Next.
25
PANIMALAR ENGINEERING COLLEGE
Then delete the code which is there and type the code as given below.
Now click on Design and your application will look as given below.
26
PANIMALAR ENGINEERING COLLEGE
Then delete the code which is there and type the code as given below.
PROGRAM
MainActivity.java:
package com.example.exno5;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
27
PANIMALAR ENGINEERING COLLEGE
OUTPUT
28
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application that makes use of Notification Manager is
done using Java with Android Studio and output is verified successfully.
29
PANIMALAR ENGINEERING COLLEGE
AIM
To develop an Android Application that implements Multi threading.
PROCEDURE
Creating a New project:
Open Android Studio and then click on File -> New -> New project.
Then select the Minimum SDK as shown below and click Next.
30
PANIMALAR ENGINEERING COLLEGE
31
PANIMALAR ENGINEERING COLLEGE
32
PANIMALAR ENGINEERING COLLEGE
OUTPUT
33
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application that uses Multi-Threading is done using
Java with Android Studio and output is verified successfully.
34
PANIMALAR ENGINEERING COLLEGE
AIM
To design and develop a mobile application which uses the GPS functionalities of a
Mobile Application Development Framework.
PROCEDURE
Then select the Minimum SDK as shown below and click Next.
36
PANIMALAR ENGINEERING COLLEGE
37
PANIMALAR ENGINEERING COLLEGE
OUTPUT
RESULT
Thus the program for developing an Application that uses GPS Location Information is done using
Java with Android Studio and output is verified successfully.
Date: 10/4/21
MOBILE APPLICATION THAT WRITES DATA TO THE SD CARD
Ex. No: 08
AIM
38
PANIMALAR ENGINEERING COLLEGE
PROGRAM
MainActivity.java:
package com.example.myapplication_sd;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
40
PANIMALAR ENGINEERING COLLEGE
fout.write(e1.getText().toString().getBytes());
fout.close();
41
PANIMALAR ENGINEERING COLLEGE
OUTPUT
43
PANIMALAR ENGINEERING COLLEGE
44
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application that writes data to SD Card is done using Java with
Android Studio and output is verified successfully.
Date: 17/4/21 MOBILE APPLICATION THAT CREATES AN ALERT UPON A
Ex. No: 09 MESSAGE
AIM
To develop an Android Application that writes data to the SD Card.
45
PANIMALAR ENGINEERING COLLEGE
Then select the Minimum SDK as shown below and click Next.
import android.content.DialogInterface;
46
PANIMALAR ENGINEERING COLLEGE
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@Override
builder.setTitle("Alert !");
builder.setCancelable(false);
@Override
finish();
47
PANIMALAR ENGINEERING COLLEGE
@Override
dialog.cancel();
});
alertDialog.show();
OUTPUT
48
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application that creates an Alert Upon Receiving a
Message is done using Java with Android Studio and output is verified successfully.
Date: 24/4/21
MOBILE APPLICATION THAT MAKES USE OF RSS FEED
Ex. No: 10
AIM
PROCEDURE
49
PANIMALAR ENGINEERING COLLEGE
50
PANIMALAR ENGINEERING COLLEGE
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.exno6" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
51
PANIMALAR ENGINEERING COLLEGE
<intent-filter>
</manifest>
Then delete the code which is there and type the code as given below.
PROGRAM
MainActivity.java
package com.example.myapplication_ex10;
52
PANIMALAR ENGINEERING COLLEGE
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
List headlines;
List links;
@Override
53
PANIMALAR ENGINEERING COLLEGE
super.onCreate(savedInstanceState);
new MyAsyncTask().execute();
@Override
try
factory.setNamespaceAware(false);
xpp.setInput(getInputStream(url), "UTF_8");
if (eventType == XmlPullParser.START_TAG)
if (xpp.getName().equalsIgnoreCase("item"))
insideItem = true;
else if (xpp.getName().equalsIgnoreCase("title"))
if (insideItem)
else if (xpp.getName().equalsIgnoreCase("link"))
if (insideItem)
55
PANIMALAR ENGINEERING COLLEGE
insideItem=false;
catch (MalformedURLException e)
e.printStackTrace();
catch (XmlPullParserException e)
e.printStackTrace();
catch (IOException e)
e.printStackTrace();
return null;
{
56
PANIMALAR ENGINEERING COLLEGE
setListAdapter(adapter);
@Override
startActivity(intent);
try
return url.openConnection().getInputStream();
catch (IOException e)
return null;
}} }
57
PANIMALAR ENGINEERING COLLEGE
OUTPUT
58
PANIMALAR ENGINEERING COLLEGE
AIM
PROCEDURE
Open Android Studio and then click on File -> New -> New project.
Then type the Application name as “ex.no.11″ and click Next.
Then select the Minimum SDK as shown below and click Next.
Then select the Empty Activity and click Next.
Finally click Finish.Designing layout for the Android Application:
59
PANIMALAR ENGINEERING COLLEGE
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.email">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
60
PANIMALAR ENGINEERING COLLEGE
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="message/rfc822"/>
</intent-filter>
</activity>
</application>
</manifest>
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
61
PANIMALAR ENGINEERING COLLEGE
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
eTo = (EditText)findViewById(R.id.txtTo);
eSubject = (EditText)findViewById(R.id.txtSub);
eMsg = (EditText)findViewById(R.id.txtMsg);
btn = (Button)findViewById(R.id.btnSend);
btn.setOnClickListener(new View.OnClickListener() {
@Override
it.putExtra(Intent.EXTRA_SUBJECT,eSubject.getText().toString());
it.putExtra(Intent.EXTRA_TEXT,eMsg.getText());
it.setType("message/rfc822");
});
62
PANIMALAR ENGINEERING COLLEGE
OUTPUT
63
PANIMALAR ENGINEERING COLLEGE
64
PANIMALAR ENGINEERING COLLEGE
65
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application to send an E-Mail is done using Java with Android
Studio and output is verified successfully.
Date: 15/5/21 ADDITIONAL EXPERIMENTS
AIM
PROCEDURE
Open Android Studio and then click on File -> New -> New project.
Then type the Application name as “ex.no12″ and click Next
Then select the Minimum SDK as shown below and click Next.
Then select the Empty Activity and click Next.
Finally click Finish.
Designing layout for the Android Application:
66
PANIMALAR ENGINEERING COLLEGE
PROGRAM
MainActivity.java
package com.example.sam.exno;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
67
PANIMALAR ENGINEERING COLLEGE
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.StringTokenizer;
Button one,two,three,four,five,six,seven,eight,nine,zero,equal,add,sub,mul,div,c;
TextView ed;
String op1,op2,res,op,text;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
one = findViewById(R.id.one);
two = findViewById(R.id.two);
three = findViewById(R.id.three);
four = findViewById(R.id.four);
five = findViewById(R.id.five);
six = findViewById(R.id.six);
seven = findViewById(R.id.seven);
eight = findViewById(R.id.eight);
nine = findViewById(R.id.nine);
68
PANIMALAR ENGINEERING COLLEGE
equal=findViewById(R.id.equal);
add=findViewById(R.id.plus);
sub=findViewById(R.id.sub);
mul=findViewById(R.id.mul);
div=findViewById(R.id.div);
ed = findViewById(R.id.ed);
c=findViewById(R.id.c);
one.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("1");
});
two.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("2");
});
three.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("3");
69
PANIMALAR ENGINEERING COLLEGE
});
four.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("4");
});
five.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("5");
});
six.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("6");
});
seven.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("7");
70
PANIMALAR ENGINEERING COLLEGE
});
eight.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("8");
});
nine.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("9");
});
zero.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("0");
});
c.setOnClickListener(new View.OnClickListener() {
@Override
ed.setText("");
71
PANIMALAR ENGINEERING COLLEGE
});
add.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("+");
});
sub.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("-");
});
mul.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("*");
});
div.setOnClickListener(new View.OnClickListener() {
@Override
ed.append("/");
72
PANIMALAR ENGINEERING COLLEGE
});
equal.setOnClickListener(new View.OnClickListener() {
@Override
text=ed.getText().toString();
if(text.contains("+"))
op1=tokens.nextToken();
op2=tokens.nextToken();
op = "+";
res=String.valueOf(Integer.parseInt(op1)+Integer.parseInt(op2));
ed.setText(op1);
ed.append("+");
ed.append(op2);
ed.append("=");
ed.append(res);
if(text.contains("-"))
op1=tokens.nextToken();
op2=tokens.nextToken();
73
PANIMALAR ENGINEERING COLLEGE
res=String.valueOf(Integer.parseInt(op1)-Integer.parseInt(op2));
ed.setText(op1);
ed.append("-");
ed.append(op2);
ed.append("=");
ed.append(res);
if(text.contains("*"))
op1=tokens.nextToken();
op2=tokens.nextToken();
op = "*";
res=String.valueOf(Integer.parseInt(op1)*Integer.parseInt(op2));
ed.setText(op1);
ed.append("*");
ed.append(op2);
ed.append("=");
ed.append(res);
if(text.contains("/"))
74
PANIMALAR ENGINEERING COLLEGE
op2=tokens.nextToken();
op = "/";
res=String.valueOf(Integer.parseInt(op1)/Integer.parseInt(op2));
ed.setText(op1);
ed.append("/");
ed.append(op2);
ed.append("=");
ed.append(res);
});
OUTPUT
75
PANIMALAR ENGINEERING COLLEGE
76
PANIMALAR ENGINEERING COLLEGE
RESULT
Thus the program for developing an Application for Calculator is done using Java with
Android Studio and output is verified successfully.
AIM
PROCEDURE
Open Android Studio and then click on File -> New -> New project.
77
PANIMALAR ENGINEERING COLLEGE
78
PANIMALAR ENGINEERING COLLEGE
79
PANIMALAR ENGINEERING COLLEGE
81
PANIMALAR ENGINEERING COLLEGE
Then delete the code which is there and type the code as given below.
Activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
82
PANIMALAR ENGINEERING COLLEGE
android:layout_height="match_parent"
android:orientation="vertical">
<TimePicker
android:id="@+id/timePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<ToggleButton
android:id="@+id/toggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dp"
android:checked="false"
android:onClick="OnToggleClicked" />
</LinearLayout>
83
PANIMALAR ENGINEERING COLLEGE
Now change the activity tag to receiver tag in the AndroidManifest.xml file as shown below
84
PANIMALAR ENGINEERING COLLEGE
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.exno11" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<intent-filter>
</activity>
</application>
</manifest>
Then delete the code which is there and type the code as given below.
PROGRAM
MainActivity.java
package com.example.exno;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Intent;
86
PANIMALAR ENGINEERING COLLEGE
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TimePicker;
import android.widget.Toast;
import android.widget.ToggleButton;
import java.util.Calendar;
TimePicker alarmTimePicker;
PendingIntent pendingIntent;
AlarmManager alarmManager;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
long time;
if (((ToggleButton) view).isChecked())
87
PANIMALAR ENGINEERING COLLEGE
calendar.set(Calendar.HOUR_OF_DAY, alarmTimePicker.getCurrentHour());
calendar.set(Calendar.MINUTE, alarmTimePicker.getCurrentMinute());
time=(calendar.getTimeInMillis()-(calendar.getTimeInMillis()%60000));
if(System.currentTimeMillis()>time)
if (calendar.AM_PM == 0)
else
else
alarmManager.cancel(pendingIntent);
88
PANIMALAR ENGINEERING COLLEGE
Then delete the code which is there and type the code as given below.
AlarmReceiver.java:
package com.example.exno13;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.widget.Toast;
89
PANIMALAR ENGINEERING COLLEGE
@Override
if (alarmUri == null)
alarmUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
ringtone.play();
90
PANIMALAR ENGINEERING COLLEGE
OUTPUT
RESULT
Thus the program for developing an Application that creates Alarm Clock is done using Java
with Android Studio and output is verified successfully.
91