You are on page 1of 62

An Android app For Elder people voice based medicine Remainder

alert

Synopsis
In this system, we develop android smart phone application to assists elderly
people for independent living with their wishes. It reduces the burden of allotting
health care professionals in homes to monitor elder persons. Smartphone application
gives services and assists the elderly person to complete their daily life activities as
others. This application Patients need not remember their medicine dosage timings
as they can set their dosage timings. Voice based Remainder notification alert can
be set for multiple medicines and timings including date, time and medicine
description, this application will remind their user about the medicine in-take
schedule. This mobile application integrates with multiple color button option.
Whenever the user click on the emergency color button based on color pattern action
will be performed. For example if user click red button “Emergency ”this message
automatically send to register members mobile number .By pressing the color button
based on color this mobile application automatically send the service message to
particular register mobile number and mail id. It is quite possible you can
communicate effectively to explain your position to family members. This helps to
identify protect and call on resources to help the one out of dangerous situations.

Elder people can able select disease details based on this disease application
automatically shows Home Remedies details effectively. So this application is
having both safety and security.

Introduction
In day-to-day life most of the people need to take medicines which was not
there in past couple of years and the reason behind this is diseases are increasing in
large amount. So sooner or later many people come in contact with these diseases.
Some diseases are temporary diseases while many are permanent life threatening
diseases. Life threatening diseases gets mixes with the human body in such a way
that they can’t leave the body ever and they increases in rapid time. Life span of
humans became less because of such diseases and to overcome or to live a better life
we need to take medicines regularly and also in large amount. We need to be in
advice of Doctor who tells us to take desired pills in desired way so that patients face
problems like forgetting pills to take at right time and also when Doctor changes the
prescription of medicine patients have to remember the new schedule of medicine.
This problem of forgetting to take pills at right time, taking wrong medicines and
accidentally taking of expired medicine causes health issues of patient and this leads
to suffer from unhealthy life. Our project is to made android based Smart phone
which uses Real time clock. Our system takes up the prescription details from the
user such as the duration of the prescription, the names of the medicines, the times
they are to be taken and the amount of each medicine which is to be taken. After all
this data has been entered, our system will remind the user at the prescribed time of
which medicine is to be taken in form of a mobile notification and a physical
reminder. The patients can leave taking medicines to just our app. Whenever the
time for the medicine is up, they will be notified and they only have to take their
prescriptions during that time, and no other time. If implemented properly, this will
drastically decrease overdose of medicines due to forgetfulness and the patients will
also be reminded to take their medicines.

Problem Statement
The main problem of this application is patients may forget to intake
of medicines right time. So it is important to take legitimate prescriptions
in appropriate amount at legitimate time. So it is necessary to take proper
medicines in proper time interval. Existing system is more time
consuming processes some persons should be there in the house to
monitor the elder people.

Existing system
A large portion of times patients may neglect to take the meds at
legitimate time according to the predetermined in the solution which may
cause in late recuperation from the ailment/disease. So it is important to
take legitimate prescriptions in appropriate amount at legitimate time. So
it is necessary to take proper medicines in proper time interval. Existing
system is more time consuming processes some persons should be there
in the house to monitor the elder people.

Disadvantage

• There is no facility of reminding alert intake medicine details.


• The patients may not remember to take the medicines at correct time
as per the specified in the prescription.
• Present IoT enabled system will generate an alert so that the patient
can take required medicine at proper time but this system too much
costly.
Proposed system

The drawbacks, which are faced during existing system, can be


eradicated by using the mobile application. The main objective of the
proposed system is to provide a user-friendly android mobile application.
The proposed system is based on Android Operating system which will
remind the users to take medicines on time through voice based
notification and automatic alarm ringing system. This application helps
the patients for the intake of medicines voice based reminder alert at the
right time.

The proposed system providing a robust, user friendly solution for


the patient and family members. The mobile application also maintains
the basic details of such as, medicine details, remainder schedule
information etc.

Advantage

• This is a free application that can be installed on the mobiles.


• Smartphone application gives services and assists the elderly person to complete
their daily life activities as others.
• This application will voice based remind alert their user about the medicine in-
take schedule.
• It reduces the burden of allotting health care professionals in homes

SYSTEM REQUIREMENT

HARDWARE REQUIREMENT

➢ CPU type : Intel

➢ Clock speed : 3.0 GHz

➢ Ram size : 4 GB

➢ Hard disk capacity : 500 GB

➢ Monitor type : 15 Inch color monitor

➢ Keyboard type : internet keyboard

SOFTWARE REQUIREMENT

➢ Operating System : Windows, Mac, Linux, etc (any one)

➢ Language : JAVA

➢ Back End : SQLite

➢ IDE : Android Studio

➢ Documentation : Ms-Office

Modules
1. User Register/Authentication

This module is mainly based on mobile user. Using this module user can
register in the registration form he has to fill with personal details such as name,
address, mobile number mail id and username, password etc. This will maintain in a
separate table. Using this password user can log on this mobile application. After the
successful login they can use app feature effective manner.

2. Medicine Remainder setting process

using this module user can scheduling reminder activities such as


reminder date, medicine ,timing information efficiently ,and also user can edit and
delete these details so these all the information maintain the separate table .this
application will be a solution for so many people can able to view and set medicine
intake time reminder details efficient way. User can get remainder notification
through mobile phone.

3. Voice Storing Process

In this module helps to intially user they can able to store customize voice in
folder. Based on the storage application automatically check

4. Voice based Reminder Alert


A regulator is a particular type of clock used for calculating specific time
intervals. This timer dynamically monitors the time details. This timer event will
activate when ever Time will match with user Set Time interval. Once Timer event
call this application produce voice based Medicine remainder alert to elder people
effectively.

5. View Remainder Info

This module completed based on user. User can view remainder details and
he has a right to add and edit medicine and reminder details easy and effective
manner.

6. Color Based service Selection Process

This module helps to send service message related information whenever the
elder people click on the emergency color button such as red button “Emergency
”this message automatically send to register members mobile number .By pressing
the color button based on color this mobile application automatically send the service
message to particular register mobile number.

7. Home Remedies

This module helps user to know complete home remedies details. Elder people
can able select disease details based on this disease application automatically shows
Home Remedies details effectively. Elder people they can view remedies effectively.

Data Flow Diagram

Data Flow Diagram


Level-0

Enter medicine intake timing Receive voice based


details Notification and Emergency
option

Medical
User Remain Elder People
der

View info Emergency option

Level 1
Register
User User register
/Login

Store reminder details

Add
reminder Reminder info

Notificatio Elder people


n Process

Receive voice based


Notification

Level 2
Emergenc
Elder people Number table
y
Intimation

User

Get emergency
Notification

Alarm Reminder info

Receive voice based


Notification

Elder people
Table name: Register

Primary key: user ID

Fields Data Type Description Constraints

user ID Varchar(50) Id of the Customer Primary key

Name Varchar(50) Name of the Customer Not Null

Address Varchar(50) Address Not Null

Phno numeric(10, 0) Phone number Not Null

Email ID Varchar(50) Email id of Customer Not Null

password Varchar(50) Gender Not null

Reminder info

Fields Data Type Description Constraints

Name of medicine Varchar(10) Medicine name Not Null

Timing details Date/time Intake timing details Not Null

Dosage Varchar(10) Dosage info Not Null

Date Date Data information Not Null

Number info
Fields Data Type Description Constraints

Emg_number Integer (10) Contact Number Details Not Null


ER diagram:

Contact Addres
s
Passwor
Passwor U id
Name d
d
Email id
User
id
Registration Log Login
in
1 to 1
to1details

Aler
t
1 to m

Reminder

Name of Date
Medicine

Time Dosage

Architecture diagram
4
1 2 3 Set
Medicine Database
Register/Login
Reminder

6
5
Voice Based Time
Medicine
checking
Reminder Alert
process

Elder people
FEASIBILITY STUDY

A system is a feasible system only if it is feasible within limited recourse and


time. In this system each and every process can be feasible for the user and also
developer. It proved user friendly input such as device independent inputs and
getting proper solution for the problem.

The different types of feasible system that have to analyze are,

➢ Technical Feasibility
➢ Behavioral Feasibility
➢ Economical Feasibility
➢ Operational Feasibility

Technical Feasibility

Technical Feasibility is the assessment of the technical view of the system.


The system is developed for Dot net environment; a platform independent tool is
used to develop the system.

The consideration those are normally associated with the technical feasibility
include the following
➢ Development risk
➢ Resource availability
➢ Technology
The development risk concerns the probability, the function of all elements
and its performance should be same in all platforms and in the system that is being
developed. This system is developed according to the standards and the development
software tools are selected in such a way to avoid the problems cited above.
The software used to develop this system is Windows XP, visual studio Dot net is
done efficiently, and the concept of SQL helps to create the application backend.
These components are also helpful in providing interactivity to Java applications.

Behavioral Feasibility

It is common knowledge that computers illustrations have something to do


with turnover transfers, retraining and changes in user or developer status. The main
emphasis is customer service, personal contacts with customers.

Feasibility report is directed towards management. It evaluates the impact of


the proposed changes on the area in question. The report is a formal document for
management use, brief enough and sufficiently non-technical to be understood.

Economical Feasibility

Economic feasibility or cost benefit is an assessment of the economic


justification for a computer based system project. Though this system the
administrator can use the tool from anywhere within their concern. The system is
developed using the existing resources. So the project is economically feasible.

This is the most frequently used method for evaluating the effectiveness of a
user system. More commonly, know as cost analysis the procedure is to determine
the benefits and savings that are expected from a candidate system and compare
them with costs.

This system getting hundreds present economical feasibility. It will be


achieved goal very efficiently. And evolution of development cost (hardware and
software needed) is weighted against the ultimate income or benefit derived from
the system. Finally, it is assured that this project is economically feasible
Operational Feasibility:

Operational Feasibility deals with the study of prospects of the system. This
system operationally eliminates all the tensions of the administrator and helps in
effectively tracking the project progress. This kind of automation will surely reduce
the time and energy, which previously consumed in manual work. Based on the
study, the system proved to be operationally feasible.
LANGAUGE SPECIFICATION

Android

Android is an open source and Linux-based Operating System for mobile


devices such as smart phones and tablet computers. Android was developed by
the Open Handset Alliance, led by Google, and other companies.

Android offers a unified approach to application development for mobile devices


which means developers need only develop for Android, and their applications
should be able to run on different devices powered by Android.

Features of Android

1. Beautiful UI

Android OS basic screen provides a beautiful and intuitive user interface.

2. Connectivity

GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-Fi, LTE, NFC and
WiMAX.

3 Storage

SQLite, a lightweight relational database, is used for data storage purposes.

4. Media support

H.263, H.264, MPEG-4 SP, AMR, AMR-WB, AAC, HE-AAC, AAC 5.1,
MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP.
5. Messaging

SMS and MMS

6 .Web browser

Based on the open-source WebKit layout engine, coupled with Chrome's V8


JavaScript engine supporting HTML5 and CSS3.

7. Multi-touch

Android has native support for multi-touch which was initially made available
in handsets such as the HTC Hero.

8. Multi-tasking

User can jump from one task to another and same time various applications
can run simultaneously.

9. Resizable widgets

Widgets are resizable, so users can expand them to show more content or
shrink them to save space.

10. Multi-Language

Supports single direction and bi-directional text.

Android Architecture Diagram:


The above figure shows the diagram of Android Architecture. The Android
OS can be referred to as a software stack of different layers, where each layer is a
group of several program components. Together it includes operating system,
middleware and important applications. Each layer in the architecture provides
different services to the layer just above it. We will examine the features of each
layer in detail.

Linux Kernel

The basic layer is the Linux kernel. The whole Android OS is built on top of
the Linux 2.6 Kernel with some further architectural changes made by Google. It is
this Linux that interacts with the hardware and contains all the essential hardware
drivers. Drivers are programs that control and communicate with the hardware. For
example, consider the Bluetooth function. All devices has a Bluetooth hardware in
it. Therefore the kernel must include a Bluetooth driver to communicate with the
Bluetooth hardware. The Linux kernel also acts as an abstraction layer between the
hardware and other software layers. Android uses the Linux for all its core
functionality such as Memory management, process management, networking,
security settings etc.As the Android is built on a most popular and proven
foundation, it made the porting of Android to variety of hardware, a relatively
painless task.

Libraries

The next layer is the Android’s native libraries. It is this layer that enables the device
to handle different types of data. These libraries are written in c or c++ language and
are specific for a particular hardware.

Some of the important native libraries include the following:

Surface Manager: It is used for compositing window manager with off-screen


buffering. Off-screen buffering means you can’t directly draw into the screen, but
your drawings go to the off-screen buffer. There it is combined with other drawings
and form the final screen the user will see. This off screen buffer is the reason behind
the transparency of windows.

Media framework: Media framework provides different media codecs allowing the
recording and playback of different media formats

SQLite: SQLite is the database engine used in android for data storage purposes

WebKit: It is the browser engine used to display HTML content


OpenGL: Used to render 2D or 3D graphics content to the screen

Android Runtime

Android Runtime consists of Dalvik Virtual machine and Core Java libraries.

Dalvik Virtual Machine

It is a type of JVM used in android devices to run apps and is optimized for low
processing power and low memory environments. Unlike the JVM, the Dalvik
Virtual Machine doesn’t run .class files, instead it runs .dex files. .dex files are built
from .class file at the time of compilation and provide hifger efficiency in low
resource environments. The Dalvik VM allows multiple instance of Virtual machine
to be created simultaneously providing security, isolation, memory management and
threading support. It is developed by Dan Bornstein of Google. Libraries:
These are different from Java SE and Java ME libraries. However these libraries
provide most of the functionalities defined in the Java SE libraries.

Application Framework

These are the blocks that our applications directly interact with. These programs
manage the basic functions of phone like resource management, voice call
management etc. As a developer, you just consider these are some basic tools with
which we are building our applications.

Important blocks of Application framework are:

Activity Manager: Manages the activity life cycle of applications

Content Providers: Manage the data sharing between applications

Telephony Manager: Manages all voice calls. We use telephony manager if we


want to access voice calls in our application.
Location Manager: Location management, using GPS or cell tower

Resource Manager: Manage the various types of resources we use in our


Application

Applications

Applications are the top layer in the Android architecture and this is where our
applications are gonna fit. Several standard applications comes pre-installed with
every device, such as:

▪ SMS client app

▪ Dialer

▪ Web browser

▪ Contact manager

As a developer we are able to write an app which replace any existing system app.
That is, you are not limited in accessing any particular feature. You are practically
limitless and can whatever you want to do with the android (as long as the users of
your app permit it). Thus Android is opening endless opportunities to the developer.

Android Applications
Android applications are usually developed in the Java language using the
Android Software Development Kit.

Once developed, Android applications can be packaged easily and sold out either
through a store such as Google Play, Slide ME, Opera Mobile Store, Mobango, F-
droid and the Amazon Appstore.Android powers hundreds of millions of mobile
devices in more than 190 countries around the world. It's the largest installed base
of any mobile platform and growing fast. Every day more than 1 million new
Android devices are activated worldwide.

2) Android IDE

There are so many sophisticated Technologies are available to develop


android applications, the familiar technologies, which are predominantly using tools
as follows

1. Android Studio

Android Studio is the integrated development environment (IDE) for Google's


Android operating system, built on Jet Brains' IntelliJ IDEA software and designed
specifically for Android development. It is available for download on Windows,
macOS and Linux based operating systems It is a replacement for the Eclipse
Android Development Tools (ADT) as primary IDE for native Android application
development.

Android Studio’s job is to provide the interface for you to create your apps
and to handle much of the complicated file-management behind the scenes. The
programming language you will be using is Java and this will be installed separately
on your machine. Android Studio is simply where you will write, edit and save your
projects and the files that comprise said projects. At the same time, Android Studio
will give you access to the Android SDK or ‘Software Development Kit’. Think of
this as an extension to the Java code that allows it to run smoothly on Android
devices and take advantage of the native hardware. Java is needed to write the
programs, the Android SDK is needed to make those programs run on Android and
Android Studio has the job of putting it all together for you. At the same time,
Android Studio also enables you to run your code, either through an emulator or
through a piece of hardware connected to your machine. You’ll then also be able to
‘debug’ the program as it runs and get feedback explaining crashes etc. so that you
can more quickly solve the problem.

3. Android Emulator

Android Emulator is used to run, debug and test the android application. If you don't
have the real device, it can be the best way to run, debug and test the application.

Genymotion

Genymotion is a very popular Android emulation platform. It is quite powerful and


features emulation environments of virtually any device available for sale in the
market, past, present and future (with sporadic updates).

There are premium versions of this app that add features, but with a little elbow
grease one can manage on one’s own with the free version. It does not come with
ARM support, so you will need to install it manually, which makes it a little less
convenient to use

Features

Robust Environment.

Visually appealing.

Advanced features like OpenGL and Hardware Acceleration support.

Fastest of the bunch (based on x86 architecture).

XML

Android layouts are written in eXtensible Markup Language, also known as XML.
Much like HTML (or Hypertext Markup Language), XML is also a markup
language. It was created as a standard way to encode data in internet-based
applications. However, unlike HTML, XML is case-sensitive, requires each tag is
closed properly, and preserves whitespace.

Much like creating an HTML layout and later altering it with jQuery, as we've done
in previous courses, we can create XML layouts in Android, and later alter them
using Java logic. Android XML layouts are also part of a larger umbrella of Android
files and components called resources. Resources are the additional files and static
content an application needs, such as animations, color schemes, layouts, menu
layouts.

Layout Attributes

Every type of layout has attributes that define the way its elements appear.
There are both common attributes that all layouts share, and attributes specific to
some of the layout types listed above. The following are attributes that apply to all
layouts:

Android: id: A unique ID that corresponds to the view.

Android: layout_width: The width of the layout. (Required for every view)

Android: layout_height: The height of the layout. (Required for every view).

SQLite

SQLite is embedded relational database management system. It is self-


contained, serverless, zero configuration and transactional SQL database engine.

SQLite is free to use for any purpose commercial or private. In other words, "SQLite
is an open source, zero-configuration, self-contained, stand alone, transaction
relational database engine designed to be embedded into an application".
SQLite is different from other SQL databases because unlike most other SQL
databases, SQLite does not have a separate server process. It reads and writes
directly to ordinary disk files. A complete SQL database with multiple tables,
indices, triggers, and views, is contained in a single disk file.

SQLite was designed originally on August 2000. It is named SQLite because it is


very light weight (less than 500Kb size) unlike other database management systems
like SQL Server or Oracle.

SQLite Features

• SQLite is totally free: SQLite is open-source. So, no license is required to


work with it.
• SQLite is serverless: SQLite doesn't require a different server process or
system to operate.
• SQLite is very flexible: It facilitates you to work on multiple databases on
the same session on the same time.
• Configuration Not Required: SQLite doesn't require configuration. No
setup or administration required.
• SQLite is a cross-platform DBMS: You don't need a large range of different
platforms like Windows, Mac OS, Linux, and Unix. It can also be used on a
lot of embedded operating systems like Symbian, and Windows CE.
• Storing data is easy: SQLite provides an efficient way to store data.
• Variable length of columns: The length of the columns is variable and is not
fixed. It facilitates you to allocate only the space a field needs. For example,
if you have a varchar (200) column, and you put a 10 characters' length value
on it, then SQLite will allocate only 20 characters' space for that value not the
whole 200 space.
• Provide large number of API's: SQLite provides API for a large range of
programming languages. For example: .Net languages (Visual Basic, C#),
PHP, Java, Objective C, Python and a lot of other programming language.
• SQLite is written in ANSI-C and provides simple and easy-to-use API.

SQLite Advantages

SQLite is a very popular database which has been successfully used with on
disk file format for desktop applications like version control systems, financial
analysis tools, media cataloging and editing suites, CAD packages, record keeping
programs etc.

There are a lot of advantages to use SQLite as an application file format:

1) Lightweight

o SQLite is a very light weighted database so, it is easy to use it as an embedded


software with devices like televisions, Mobile phones, cameras, home
electronic devices, etc.

2) Better Performance

o Reading and writing operations are very fast for SQLite database. It is almost
35% faster than File system.

o It only loads the data which is needed, rather than reading the entire file and
hold it in memory.
o If you edit small parts, it only overwrite the parts of the file which was
changed.

3) No Installation Needed

o SQLite is very easy to learn. You don’t need to install and configure it. Just
download SQLite libraries in your computer and it is ready for creating the
database.

4) Reliable

o It updates your content continuously so, little or no work is lost in a case of


power failure or crash.

o SQLite is less bugs prone rather than custom written file I/O codes.

o SQLite queries are smaller than equivalent procedural codes so, chances of
bugs are minimal.

5) Portable

o SQLite is portable across all 32-bit and 64-bit operating systems and big- and
little-endian architectures.

o Multiple processes can be attached with same application file and can read
and write without interfering each other.

o It can be used with all programming languages without any compatibility


issue.

6) Accessible

o SQLite database is accessible through a wide variety of third-party tools.


o SQLite database's content is more likely to be recoverable if it has been lost.
Data lives longer than code.

7) Reduce Cost and Complexity

o It reduces application cost because content can be accessed and updated using
concise SQL queries instead of lengthy and error-prone procedural queries.

o SQLite can be easily extended in in future releases just by adding new tables
and/or columns. It also preserves the backwards compatibility.

SYSTEM DESIGN

Systems design is the process of defining the architecture, modules, interfaces,


and data for a system to satisfy specified requirements. Systems design could be seen
as the application of systems theory to product development.

FILE DESIGN
The file system is used to control how data is stored and retrieved. Without a
file system, information placed in a storage area would be one large body of data
with no way to tell where one piece of information stops and the next begins. By
separating the data into individual pieces, and giving each piece a name, the
information is easily separated and identified. Taking its name from the way paper-
based information systems are named, each group of data is called a file. The
structure and logic rules used to manage the groups of information and their names
are called a "file system”. There are many different kinds of file systems. Each one
has different structure and logic, properties of speed, flexibility, security, size and
more. Some file systems have been designed to be used for specific applications

INPUT DESIGN

Input Design converts the user-oriented inputs to computer-based formats.


Inaccurate input data are the most common cause of errors in data processing. Error
data entered by the data operator can be controlled by the input design. The goal of
designing input is to make the data entry easy, logical and as free from errors as
much as possible.
The proposed system is completely menu-driven. It is a powerful tool for
interactive design. It helps the user comprehend the range of alternatives available
and also prevents them from making an invalid selection. All entry screens are
interactive in nature. It has been designed taking into account all the constraints of
the end-user.
Some other features included are:
➢ The form title clearly states the purpose of the form
➢ Adequate space is given for data entry
Data Validation is done for eliminating duplicate entries
OUTPUT DESIGN

Outputs are the most important and direct source of information to the customer
and management. Intelligent output design will improve the system's relationship
with the user and help in decision making. Outputs are used to make permanent hard
copy of the results for later consultation. The output generated by the system is often
regarded as the criteria for evaluating the performance of the system. The output
design was based on the following factors.
➢ Usefulness determining the various outputs to be printed to the system
user.
➢ Differentiating between the outputs to be displayed and those to be printed.
➢ The format for the presentation of the output.

For the proposed system, it is necessary that the output should be compatible with
the existing manual reports. The outputs have been formatted with this consideration
in mind. The outputs are obtained after all the phase, from the system can be
displayed or can be produced in the hard copy. The hard copy is highly preferred
since it can be used by the controller section for future reference and it can be used
for maintaining the record.

DATABASE DESIGN

The general theme behind a database is to handle information in an integrated


manner. There is none of the artificiality that is normally embedded in separate files
or applications. A database is collection of interrelated data stored with minimum
redundancy to serve many users quickly and efficiently. The general objective is to
make information access easy, quick, inexpensive and flexible for the user.
In a database environment, common data are available which several
authorized users can use. The concept behind a database is an integrated collection
of data and provides a centralized access to the data from the program. It makes
possible to treat data as a separate resource.
While designing database, several objectives must be considered:
➢ Controlled redundancy
➢ Data Independence
➢ More information at low cost
➢ Accuracy and Integrity
➢ Recovery from failure
➢ Privacy and security
➢ Performance
Steps for Table Design
➢ State what kind of information we need to handle to get the desired output.
➢ Find out what information is needed for fields (i.e.) field type, size etc.
➢ Remove any data items, which is redundant.
➢ Table have one to one relationship needs a primary key field.
➢ Tables have one to many relationship needs to add a foreign key field to the
table to match the primary key field table
SYSTEM TESTING AND MAINTENANCE

Objectives of Testing

Software testing is a critical element of software quality assurance that


represents the ultimate review of specifications, design and coding. The user tests
the developed system and changes are made according to their needs. The testing
phase involves the testing of developed system using various kinds of data. It
involves user training, system testing and successful running of the developed
system.
The changes are made according to their needs. The testing phase involves the
testing of the developed system using various kinds of data. While testing, errors are
noted and corrections are made system testing is the stage of implementation, which
is aimed at ensuring that the system works accurately and efficiently before live
operation commences. The candidate system is subject to a variety of test: stress
recovery, and security and usability tests.

Test Plan

Testing is the process of executing a program with the intent of finding any
errors. A good test of course has the high probability of finding a yet undiscovered
error. A successful testing is the one that uncovers a yet undiscovered error.

A test is vital to the success of the system; system test makes a logical
assumption that if all parts of the system are correct, then goal will be successfully
achieved. The candidate system is subjected to a verity of tests online like
responsiveness, its value, stress and security. A series of tests are performed before
the system is ready for user acceptance testing.

Testing Methods

The different types of testing are:-

• Unit Testing
• Integration Testing
• Validation Testing
• Output Testing

UNIT TESTING
Unit testing focuses verification efforts on the smallest unit of software
design, the module. This is also known as “Module Testing” The modules are tested
separately this testing is carried out during programming stage itself. In this step
each module is found to be working satisfaction as regard to the expected output
from the module.

INTEGRATION TESTING

Integration testing focuses on the design and construction of the software


architecture. Data can be lost across an interface, one module can have adverse effect
on another sub functions and show on. Thus integration testing is a systematic
technique for constructing test to uncover errors associated with in the interface. In
this project, all the modules are companied and then the entire program is tested as
a whole.

VALIDATION TESTING

Validation testing is the requirement established as a part of software


requirement analysis is validated against the software that has been constructed. This
test provides the final assurance whether the software needs all functional,
behavioral and performance requirements

Thus the proposed system under consideration has been tested by using
validation testing and found to be working satisfactory.

OUTPUT TESTING

After performing the validation testing, the next step is the output testing of
the proposed system, since no system could be useful if it does not produce required
output in the specific format. Tested asking the users about the format required by
them, the output is considered into two ways: one is on the screen and the other is
printed format.

The output format on the screen is found to be correct as the format designed
according to the user needs, for the hard copy also, the output comes as specified by
the user. Hence output testing does not result in correction in the system.

SYSTEM IMPLEMENTATION

Implementation is the stage where the theoretical design is turned into a


working system. The most crucial stage in achieving a new successful system and in
giving confidence on the new system for the users that it will work efficiently and
effectively. The system can be implemented only after thorough testing is done and
if it is found to work according to the specification. It involves careful planning,
investigation of the current system and its constraints on implementation, design of
methods to achieve the change over and an evaluation of change over methods a part
from planning. Two major tasks of preparing the implementation are education and
training of the users and testing of the system.

The more complex the system being implemented, the more involved will be
the systems analysis and design effort required just for implementation. The
implementation phase comprises of several activities. The required hardware and
software acquisition is carried out. The system may require some software to be
developed. The mobile application is implemented in android as front end sqlite as
back end.

System Development

After the successful completion of the design phase, the next important step,
which comes into account, is the development of the system according to the
specified design. The main procedure of this phase is the coding of the designed
system, in order to satisfy the requirements. The detailed input/output, text
manipulation, logic comparison and storage/retrieval operation during system
analysis stage provide the input for program preparation. Coding was carried out in
a step-by-step manner. One or more programmers convert these operations into a
program of instructions return a language and form acceptable to the computer
hardware. User inter activeness was given stress and the system use maximum
flexibility. Proper validations are done for every user-defined function

Conclusion

Implementation is the stage of the project when the theoretical design is turned
out into a working system. Thus it can be considered to be the most critical stage in
achieving a successful new system and in giving the user, confidence that the new
system will work and be effective. Proposed system successfully implements an
automatic medicine Remainder alert process. Its automatically gives Remainder
notification alert based on time interval. Any person who has android mobile phone
can use this application. This brings a smart appointment booking system that
provides patients or any user an easy way of booking a doctor’s appointment via
mobile phone. Doctor can view the requested appointment details through this
mobile application and doctor can able to give conformation/rejection which gives
a direct reply to user mobile phone when the appointment is made conform or reject.
This proposed mobile application providing a robust, user friendly solution for the
patient and doctor.

SCOPE OF FUTURE DEVELOPMENT

Every application has its own merits and demerits. The project has covered
almost all the requirements. Further requirements and improvements can easily be
done since the coding is mainly structured or modular in nature. Changing the
existing modules or adding new modules can append improvements. Further
enhancements can be made to the application with IOT interface, The patient can
store the respective time of the unique medicine by a matrix keypad. Based on an
RTC (Real Time Clock) interfaced to the microcontroller, the programmed time for
medicinal drug is displayed on the LCD in conjunction with a buzzer sound to alert
the patient approximately taking the best medicine.

BIBLIOGRAPHY
[1] Programming Android: Java Programming for the New Generation of
Mobile Devices.

[2] Elias. M. Award, 1991, ‘System Analysis and Design’ Galgotia Publication
Pvt. Ltd.

[3] Professional Android Application Development (Wrox Programmer to


Programmer) Paperback – November 24, 2008

[4] Creating Android Applications: Develop and Design by Chris


Haseman (Author).

[5] The Busy Coder's Guide to Advanced Android Development by Mr. Mark L
Murph 20 Jul 2011

[6] Mike Gunderloy,JosephL.Jorden (2001), ‘Mastering MYSQL Server’, BPB


Publications.

[7] Mridula Parihar, 2002, ‘professional Android 4 Application Development’,


Second Edition, By Mr. Mark L Murphy.

[8] Rogers Pressman, 2001, ‘Software Engineering’, Fifth Edition, McGraw-Hill


Publication.
WEBSITES
• http://www.onjava.com
• http://java.sun.com
• http://www.java.net
• https://www.ibm.com
• http://www.javaworld.com

Sample code
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.telephony.SmsManager;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;

import java.util.Timer;
import java.util.TimerTask;

public class AlarmNotification extends Activity


{
private final String TAG = "AlarmMe";
intfg=0;
private AudioManagermyAudioManager;
private Ringtone mRingtone;
private Vibrator mVibrator;
private final long[] mVibratePattern= {0, 500, 500 };
private booleanmVibrate;
private Uri mAlarmSound;
private long mPlayTime;
private Timer mTimer= null;
private Alarm mAlarm;
private DateTimemDateTime;
private TextViewmTextView;
private PlayTimerTaskmTimerTask;
intCount_info=1;
intstatus=0;
MediaPlayermediaPlayer1;
@Override
protected void onCreate(Bundle bundle)
{
super.onCreate(bundle);

getWindow().addFlags(
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);

setContentView(R.layout.notification);

mDateTime= new DateTime(this);


mTextView= (TextView)findViewById(R.id.alarm_title_text);

readPreferences();

mRingtone= RingtoneManager.getRingtone(getApplicationContext(), mAlarmSound);


if (mVibrate)
mVibrator= (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);

start(getIntent());
}

@Override
protected void onDestroy()
{
super.onDestroy();
Log.i(TAG, "AlarmNotification.onDestroy()");

stop();
}

@Override
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
Log.i(TAG, "AlarmNotification.onNewIntent()");

addNotification(mAlarm);

stop();
start(intent);
}

private void start(Intent intent)


{
mAlarm= new Alarm(this);
mAlarm.fromIntent(intent);

Log.i(TAG, "AlarmNotification.start('" + mAlarm.getTitle() + "')");

mTextView.setText(mAlarm.getTitle());

mTimerTask= new PlayTimerTask();


mTimer= new Timer();
mTimer.schedule(mTimerTask, mPlayTime);

SmsManager sms;
//play alarm

//String outputFile1 = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/alarm_one.mp3";

if(mAlarm.getTitle().equalsIgnoreCase("Aspirin"))
{

String outputFile =
Environment.getExternalStorageDirectory().getAbsolutePath() + "/androidplay.mp3";

MediaPlayermediaPlayer = new MediaPlayer();

try {
Thread.sleep(5000);
//Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Aspirin.m4a");
mediaPlayer.prepare();
mediaPlayer.start();

} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();

// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

//second

if(mAlarm.getTitle().equalsIgnoreCase("Biotin"))
{

String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/androidplay.mp3";

MediaPlayermediaPlayer = new MediaPlayer();

try {

Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Biotin.m4a");
mediaPlayer.prepare();
mediaPlayer.start();

} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();


// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

//third

if(mAlarm.getTitle().equalsIgnoreCase("Gas-x"))
{

String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/androidplay.mp3";

MediaPlayermediaPlayer = new MediaPlayer();

try {

Toast.makeText(getApplicationContext(), "playing "+outputFile,


Toast.LENGTH_SHORT).show();

Thread.sleep(5000);
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Gas-x.m4a");

mediaPlayer.prepare();
mediaPlayer.start();

} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();

// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

}
}

//four

if(mAlarm.getTitle().equalsIgnoreCase("Insulin"))
{

String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/androidplay.mp3";

MediaPlayermediaPlayer = new MediaPlayer();

try {

Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Insulin.m4a");
mediaPlayer.prepare();
mediaPlayer.start();

} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();

// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

//five

if(mAlarm.getTitle().equalsIgnoreCase("K-Tab"))
{

String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/androidplay.mp3";
MediaPlayermediaPlayer = new MediaPlayer();

try {

Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/K-Tab.m4a");
mediaPlayer.prepare();
mediaPlayer.start();

} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();

// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

//six

if(mAlarm.getTitle().equalsIgnoreCase("penicillin"))
{

String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/androidplay.mp3";

MediaPlayermediaPlayer = new MediaPlayer();

try {

Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/penicillin.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();

// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

//seven

if(mAlarm.getTitle().equalsIgnoreCase("Smallpox_Vaccine"))
{

String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/androidplay.mp3";

MediaPlayermediaPlayer = new MediaPlayer();

try {

Thread.sleep(5000);

mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Smallpox_Vaccine.m4a");

Toast.makeText(getApplicationContext(), "playing "+outputFile,


Toast.LENGTH_SHORT).show();

mediaPlayer.prepare();
mediaPlayer.start();

} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();

// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

}
}

//eight

if(mAlarm.getTitle().equalsIgnoreCase("Sodium_Chloride"))
{

String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/androidplay.mp3";

MediaPlayermediaPlayer = new MediaPlayer();

try {

Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();

mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Sodium_Chloride.m4a");
mediaPlayer.prepare();
mediaPlayer.start();

} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();

// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

//nine

if(mAlarm.getTitle().equalsIgnoreCase("Vitamin_B12"))
{

String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/androidplay.mp3";

MediaPlayermediaPlayer = new MediaPlayer();

try {

Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();

mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Vitamin_B12.m4a");

mediaPlayer.prepare();
mediaPlayer.start();

} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();

// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

//ten

if(mAlarm.getTitle().equalsIgnoreCase("Vitamin_c"))
{

String outputFile = Environment.getExternalStorageDirectory().getAbsolutePath()


+ "/androidplay.mp3";

MediaPlayermediaPlayer = new MediaPlayer();

try {

Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Vitamin_c.m4a");

mediaPlayer.prepare();
mediaPlayer.start();

} catch (Exception e) {

// Toast.makeText(context, "playing " + outputFile, Toast.LENGTH_SHORT).show();

// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

// myAudioManager.setRingerMode(AudioManager.);

// ToneGeneratortoneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);


//toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);

//mRingtone.play();

//for vibrate

// if (mVibrate)
//mVibrator.vibrate(mVibratePattern, 0);
}

private void stop()


{
Log.i(TAG, "AlarmNotification.stop()");

mTimer.cancel();
mRingtone.stop();
if (mVibrate)
mVibrator.cancel();
}

public void onDismissClick(View view)


{

mediaPlayer1.stop();

finish();
}

private void readPreferences()


{
SharedPreferencesprefs = PreferenceManager.getDefaultSharedPreferences(this);

mAlarmSound= Uri.parse(prefs.getString("alarm_sound_pref", "DEFAULT_RINGTONE_URI"));


mVibrate= prefs.getBoolean("vibrate_pref", true);
mPlayTime= (long)Integer.parseInt(prefs.getString("alarm_play_time_pref", "30")) *
1000;
}

private void addNotification(Alarm alarm)


{
NotificationManagernotificationManager =
(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification;
PendingIntent activity;
Intent intent;

Log.i(TAG, "AlarmNotification.addNotification(" + alarm.getId() + ", '" +


alarm.getTitle() + "', '" + mDateTime.formatDetails(alarm) + "')");

intent = new Intent(this.getApplicationContext(), AlarmMe.class);


intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);

activity = PendingIntent.getActivity(this, (int)alarm.getId(), intent,


PendingIntent.FLAG_UPDATE_CURRENT);

NotificationCompat.Builder builder = new NotificationCompat.Builder(this);


notification = builder
.setContentIntent(activity)
.setSmallIcon(R.drawable.ic_notification)
.setAutoCancel(true)
.setContentTitle("Missed alarm: " + alarm.getTitle())
.setContentText(mDateTime.formatDetails(alarm))
.build();

notificationManager.notify((int)alarm.getId(), notification);
}

@Override
public void onBackPressed()
{
finish();
}

private class PlayTimerTaskextends TimerTask


{
@Override
public void run()
{

Log.i(TAG, "AlarmNotification.PalyTimerTask.run()");
addNotification(mAlarm);
finish();
}
}
}
/**************************************************************************
*
* Copyright (C) 2012-2015 Alex Taradov<alex@taradov.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*************************************************************************/

package com.taradov.alarmme;

import java.lang.System;
import java.util.Arrays;
import java.util.GregorianCalendar;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuInflater;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.Toast;
import android.widget.Button;
import android.widget.ListView;
import android.widget.AdapterView;
import android.content.Intent;
import android.content.Context;
import android.content.BroadcastReceiver;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import com.taradov.alarmme.Alarm;
import com.taradov.alarmme.AlarmReceiver;
import com.taradov.alarmme.AlarmListAdapter;
import com.taradov.alarmme.About;

import android.app.AlarmManager;
import android.app.PendingIntent;

// Toast.makeText(getApplicationContext(), "Delete" + index,


Toast.LENGTH_SHORT).show();

public class AlarmMeextends Activity


{
private final String TAG = "AlarmMe";

private ListViewmAlarmList;
private AlarmListAdaptermAlarmListAdapter;
private Alarm mCurrentAlarm;
private final intNEW_ALARM_ACTIVITY = 0;
private final intEDIT_ALARM_ACTIVITY = 1;
private final intPREFERENCES_ACTIVITY = 2;
private final intABOUT_ACTIVITY = 3;

private final intCONTEXT_MENU_EDIT = 0;


private final intCONTEXT_MENU_DELETE = 1;
private final intCONTEXT_MENU_DUPLICATE = 2;

@Override
public void onCreate(Bundle bundle)
{
super.onCreate(bundle);
setContentView(R.layout.main);

Log.i(TAG, "AlarmMe.onCreate()");

mAlarmList= (ListView)findViewById(R.id.alarm_list);

mAlarmListAdapter= new AlarmListAdapter(this);


mAlarmList.setAdapter(mAlarmListAdapter);
mAlarmList.setOnItemClickListener(mListOnItemClickListener);
registerForContextMenu(mAlarmList);

mCurrentAlarm= null;
}

@Override
public void onDestroy()
{
super.onDestroy();
Log.i(TAG, "AlarmMe.onDestroy()");
// mAlarmListAdapter.save();
}

@Override
public void onResume()
{
super.onResume();
Log.i(TAG, "AlarmMe.onResume()");
mAlarmListAdapter.updateAlarms();
}

public void onAddAlarmClick(View view)


{
Intent intent = new Intent(getBaseContext(), EditAlarm.class);

mCurrentAlarm= new Alarm(this);


mCurrentAlarm.toIntent(intent);

AlarmMe.this.startActivityForResult(intent, NEW_ALARM_ACTIVITY);
}

@Override
protected void onActivityResult(intrequestCode, intresultCode, Intent data)
{
if (requestCode == NEW_ALARM_ACTIVITY)
{
if (resultCode == RESULT_OK)
{
mCurrentAlarm.fromIntent(data);
mAlarmListAdapter.add(mCurrentAlarm);
}
mCurrentAlarm= null;
}
else if (requestCode == EDIT_ALARM_ACTIVITY)
{
if (resultCode == RESULT_OK)
{
mCurrentAlarm.fromIntent(data);
mAlarmListAdapter.update(mCurrentAlarm);
}
mCurrentAlarm= null;
}
else if (requestCode == PREFERENCES_ACTIVITY)
{
mAlarmListAdapter.onSettingsUpdated();
}
}

@Override
public booleanonCreateOptionsMenu(Menu menu)
{
MenuInflatermenuInflater = getMenuInflater();
menuInflater.inflate(R.layout.menu, menu);
return true;
}

@Override
public booleanonOptionsItemSelected(MenuItem item)
{
if (R.id.menu_settings== item.getItemId())
{
Intent intent = new Intent(getBaseContext(), Preferences.class);
startActivityForResult(intent, PREFERENCES_ACTIVITY);
return true;
}
else if (R.id.menu_about== item.getItemId())
{
Intent intent = new Intent(getBaseContext(), About.class);
startActivity(intent);
return true;
}
else
{
return super.onOptionsItemSelected(item);
}
}

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfomenuInfo)
{
if (v.getId() == R.id.alarm_list)
{
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo)menuInfo;

menu.setHeaderTitle(mAlarmListAdapter.getItem(info.position).getTitle());
menu.add(Menu.NONE, CONTEXT_MENU_EDIT, Menu.NONE, "Edit");
menu.add(Menu.NONE, CONTEXT_MENU_DELETE, Menu.NONE, "Delete");
menu.add(Menu.NONE, CONTEXT_MENU_DUPLICATE, Menu.NONE, "Duplicate");
}
}

@Override
public booleanonContextItemSelected(MenuItem item)
{
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
intindex = item.getItemId();

if (index == CONTEXT_MENU_EDIT)
{
Intent intent = new Intent(getBaseContext(), EditAlarm.class);

mCurrentAlarm= mAlarmListAdapter.getItem(info.position);
mCurrentAlarm.toIntent(intent);
startActivityForResult(intent, EDIT_ALARM_ACTIVITY);
}
else if (index == CONTEXT_MENU_DELETE)
{
mAlarmListAdapter.delete(info.position);
}
else if (index == CONTEXT_MENU_DUPLICATE)
{
Alarm alarm = mAlarmListAdapter.getItem(info.position);
Alarm newAlarm = new Alarm(this);
Intent intent = new Intent();

alarm.toIntent(intent);
newAlarm.fromIntent(intent);
newAlarm.setTitle(alarm.getTitle() + " (copy)");
mAlarmListAdapter.add(newAlarm);
}

return true;
}

private AdapterView.OnItemClickListener mListOnItemClickListener= new


AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, intposition, long id)
{
Intent intent = new Intent(getBaseContext(), EditAlarm.class);

mCurrentAlarm= mAlarmListAdapter.getItem(position);
mCurrentAlarm.toIntent(intent);
AlarmMe.this.startActivityForResult(intent, EDIT_ALARM_ACTIVITY);
}
};

/**************************************************************************
*
* Copyright (C) 2012-2015 Alex Taradov<alex@taradov.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*************************************************************************/

package com.taradov.alarmme;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TimePicker;

import java.util.Calendar;
import java.util.GregorianCalendar;

public class EditAlarmextends Activity


{
private EditTextmTitle;
private CheckBoxmAlarmEnabled;
private Spinner mOccurence;
private Button mDateButton;
private Button mTimeButton;

private Alarm mAlarm;


private DateTimemDateTime;

private GregorianCalendarmCalendar;
private intmYear;
private intmMonth;
private intmDay;
private intmHour;
private intmMinute;

static final intDATE_DIALOG_ID = 0;


static final intTIME_DIALOG_ID = 1;
static final intDAYS_DIALOG_ID = 2;

@Override
public void onCreate(Bundle bundle)
{
super.onCreate(bundle);
setContentView(R.layout.edit);

mTitle= (EditText)findViewById(R.id.title);
mAlarmEnabled= (CheckBox)findViewById(R.id.alarm_checkbox);
mOccurence= (Spinner)findViewById(R.id.occurence_spinner);
mDateButton= (Button)findViewById(R.id.date_button);
mTimeButton= (Button)findViewById(R.id.time_button);

mAlarm= new Alarm(this);


mAlarm.fromIntent(getIntent());

mDateTime= new DateTime(this);

mTitle.setText(mAlarm.getTitle());
mTitle.addTextChangedListener(mTitleChangedListener);

mOccurence.setSelection(mAlarm.getOccurence());
mOccurence.setOnItemSelectedListener(mOccurenceSelectedListener);

mAlarmEnabled.setChecked(mAlarm.getEnabled());
mAlarmEnabled.setOnCheckedChangeListener(mAlarmEnabledChangeListener);

mCalendar= new GregorianCalendar();


mCalendar.setTimeInMillis(mAlarm.getDate());
mYear= mCalendar.get(Calendar.YEAR);
mMonth= mCalendar.get(Calendar.MONTH);
mDay= mCalendar.get(Calendar.DAY_OF_MONTH);
mHour= mCalendar.get(Calendar.HOUR_OF_DAY);
mMinute= mCalendar.get(Calendar.MINUTE);

updateButtons();
}

@Override
protected Dialog onCreateDialog(intid)
{
if (DATE_DIALOG_ID == id)
return new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay);
else if (TIME_DIALOG_ID == id)
return new TimePickerDialog(this, mTimeSetListener, mHour, mMinute,
mDateTime.is24hClock());
else if (DAYS_DIALOG_ID == id)
return DaysPickerDialog();
else
return null;
}

@Override
protected void onPrepareDialog(intid, Dialog dialog)
{
if (DATE_DIALOG_ID == id)
((DatePickerDialog)dialog).updateDate(mYear, mMonth, mDay);
else if (TIME_DIALOG_ID == id)
((TimePickerDialog)dialog).updateTime(mHour, mMinute);
}

public void onDateClick(View view)


{
if (Alarm.ONCE== mAlarm.getOccurence())
showDialog(DATE_DIALOG_ID);
else if (Alarm.WEEKLY== mAlarm.getOccurence())
showDialog(DAYS_DIALOG_ID);
}

public void onTimeClick(View view)


{
showDialog(TIME_DIALOG_ID);
}
public void onDoneClick(View view)
{
Intent intent = new Intent();

mAlarm.toIntent(intent);
setResult(RESULT_OK, intent);
finish();
}

public void onCancelClick(View view)


{
setResult(RESULT_CANCELED, null);
finish();
}

private DatePickerDialog.OnDateSetListenermDateSetListener= new


DatePickerDialog.OnDateSetListener()
{
public void onDateSet(DatePicker view, intyear, intmonthOfYear, intdayOfMonth)
{
mYear= year;
mMonth= monthOfYear;
mDay= dayOfMonth;

mCalendar= new GregorianCalendar(mYear, mMonth, mDay, mHour, mMinute);


mAlarm.setDate(mCalendar.getTimeInMillis());

updateButtons();
}
};

private TimePickerDialog.OnTimeSetListenermTimeSetListener= new


TimePickerDialog.OnTimeSetListener()
{
public void onTimeSet(TimePicker view, inthourOfDay, intminute)
{
mHour= hourOfDay;
mMinute= minute;

mCalendar= new GregorianCalendar(mYear, mMonth, mDay, mHour, mMinute);


mAlarm.setDate(mCalendar.getTimeInMillis());

updateButtons();
}
};

private TextWatchermTitleChangedListener= new TextWatcher()


{
public void afterTextChanged(Editable s)
{
mAlarm.setTitle(mTitle.getText().toString());
}

public void beforeTextChanged(CharSequence s, intstart, intcount, intafter)


{
}

public void onTextChanged(CharSequence s, intstart, intbefore, intcount)


{
}
};

private AdapterView.OnItemSelectedListenermOccurenceSelectedListener= new


Screenshot

Home page

You might also like