Báo cáo môn Application Development for Mobile Device (FPT_Greenwich University) Đề tài: Ứng dụng quản lý Thú cưng_Pet''''''''s Management Application(Android)
Trang 1APPLICATION DEVELOPMENT
FOR MOBILE DEVICES
MOBIPAWS APPLICATION (REPORT DOCUMENT)
Student Name: LY DUONG TUAN ANH Student ID: 000808060
Submission Date: 11/11/2014
Trang 2Contents
I INTRODUCTION 3
II IMPLEMENTED FEATURES 3
III BUG LIST 4
IV SPECIAL STRENGTH 4
V SCREENSHOTS 5
VI EVALUATION 39
VII CONCLUSION 39
REFERENCES
http://duythanhcse.wordpress.com/2013/04/11/bai-tap-20-thuc-hanh-ve-datepickerdialog-va-timepickerdialog-trong-android/
http://duythanhcse.wordpress.com/2013/04/04/bai-tap-10-su-dung-textview-edittext-va-button/
https://www.youtube.com/watch?v=2scZdcmlFtQ&index=5&list=PLJbBH
p6iPUiGfbicAWrfXnrgfldwDgZyp
https://www.youtube.com/watch?v=488wFcwPC14&list=PLJbBHp6iPUiGf bicAWrfXnrgfldwDgZyp&index=9
http://www.tutorialsbuzz.com/2013/11/android-sqlite-database-with.html
basetut.com/sqlite-trong-android-part-1/
Trang 3I INTRODUCTION
In this Coursework, I will build a mobile application to provide care service for pets when owners of pets have a job busy at the office and have not more free time to care them.… This application is called “MobiPaw”
“MobiPaw” application is created to help users and owner of pets can view pet’s information, easily store and manage information of the pets As well
as, daily reports for pets was created to rate the pet’s health
“MobiPaw” application has more features:
a) Register a new Pet’s information, update Pet’s Information or delete Pet’s Information
b) Search Pet’s information such as Pet’s Name or Pet’s Owner View Pet’s List and Pet’s Detail
c) Create Reports after Pet Sitters visit a pet
d) Create Phone Gap to register a Customer Profile
II IMPLEMENTED FEATURES
Trang 4III BUG LIST
attributes, not check input type
of email (example:
xxxxx@xxx.xxx)
When run application by SmartPhone, ImagesButton of Start Date and End Date are incorrect like images selected
I can’t check End date must be greater than Start Date
I don’t check length of Phone Number
When use Delete function, click
“Delete” Button on the Menu, data will be deleted and not show notification of message alert to get acceptance from the Users
In addition, my application has not good design, color and background
It is very simple compared to other present applications on the technology
market
IV SPECIAL STRENGTH
My application is a simple application It is easy to use all of standard features such as Insert, Update, Delete, Search Data
Trang 5V SCREENSHOTS
Trang 6Step 1: Click “Add New” Button to input Pet’s information
and the code of HomeMainActivity.java
Trang 8public void getStartDate()
Trang 9{
cal=Calendar.getInstance();
SimpleDateFormat sdf=null;
sdf=new SimpleDateFormat("dd/MM/yyyy",Locale.getDefault());
OnDateSetListener callback=new OnDateSetListener() {
public void onDateSet(DatePicker view, int year,
int month,
int day) {
SDate = (EditText) findViewById(R.id.txtStartDate);
SDate.setText(
(day) +"/"+(month+1)+"/"+year);
dateChoose=cal.getTime();
Step 2: After input Pet’s Information, click “Insert” Button to
continue and code of “Start Date” ImageButton
Trang 10private void DisplayPetDetails()
{
new AlertDialog.Builder(this).setTitle("Your Pet Details") setMessage("Pet's Name: "+ PetName.getText().toString() +"\n"+
Trang 11"Pet's Type: "+ PetType.getText().toString() +"\n"+ "Pet's Gender: "+ Gender.getSelectedItem().toString() +"\n"+
"Service: "+ PetService.getText().toString() +"\n"+ "Start Date: "+ Start.getText().toString() +"\n"+ "End Date: "+ End.getText().toString()+"\n"+ "Additional Comment: "+ Cmt.getText().toString()+"\n"+ "Owner's Name: "+ Name.getText().toString()+"\n"+ "Address: "+ Address.getText().toString()+"\n"+ "Phone Number: "+ Phone.getText().toString()+"\n"+ "Email: "+ Email.getText().toString())
.setNeutralButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub
} })
.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
PetName.getText().toString(), PetType.getText().toString(), Gender.getSelectedItem().toString(), PetService.getText().toString(), Start.getText().toString(),
Address.getText().toString(), Phone.getText().toString(),
Trang 12Step 3: After click “Insert” Button, Application will show a Pet’s detail We will click “Confirm” Button to insert data into database(SQLite) and this is code of Show Pet’s Detail &
Insert data
Trang 13Step 4: After click “Confirm” Button, application will show a
notification and data was inserted
Trang 14Step 5: Click “Search” Button to implement Search function
of application
Trang 15protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Trang 16btnsearch=(Button) findViewById(R.id.btnsearch);
lv=(ListView) findViewById(R.id.list);
btnsearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RadioButton ra=(RadioButton) findViewById(
rg.getCheckedRadioButtonId());
final String radioname = ra.getText().toString();
final String sname = esearch.getText().toString();
if(radioname.equals("Name of Owner")){
showdata(sname,"OName");} else{
Trang 17private void Dialog(final String id, final String name)
{
new AlertDialog.Builder(this)
.setTitle("Menu") setItems(R.array.Menu,
new DialogInterface.OnClickListener()
Trang 18{
public void onClick(DialogInterface dialoginterface,int i)
{
if(i==2){
Intent it = new Intent(getApplicationContext(), UpdateActivity.class);
it.putExtra("id", id);
}
Step 7: Press and Hold result after we search, a Menu will be
show, Click “Detail” to view Pet’s Detail
Trang 19private void DisplayPetDetails(String id)
Trang 20"Pet's Type: "+ v.get(1).toString() +"\n"+ "Pet's Gender: "+ v.get(2).toString() +"\n"+ "Service: "+ v.get(3).toString() +"\n"+ "Start Date: "+ v.get(4).toString() +"\n"+ "End Date: "+ v.get(5).toString()+"\n"+ "Additional Comment: "+ v.get(6).toString()+"\n"+ "Owner's Name: "+ v.get(7).toString()+"\n"+ "Address: "+ v.get(8).toString()+"\n"+ "Phone Number: "+ v.get(9).toString()+"\n"+ "Email: "+ v.get(10).toString())
.setPositiveButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {}}).show();
Step 8: This is Pet’s Detail, then we click “Close” to return
Menu
Trang 21Step 9: Click “Report” to create report for pet
Trang 22Step 10: like Step 7, after choose “Report”, we will input information at “Report Contents” row for pet The click
“Add” to insert into SQLite Below is a code of “Add” Button
Trang 23private class ButtonEvent implements OnClickListener
startActivity(a);
break;
case R.id.btnView: Intent b= new Intent(getApplicationContext(), ShowReportActivity.class);
b.putExtra("id", getIntent().getStringExtra("id"));
Toast.makeText(getApplicationContext(), "Report
} break;
}}}
Trang 24Step 11: After implement step 10, we will click “View” to run step 11 We will have a List of report Below is codes to show
data when click “View” Button
Trang 25private void showdata()
{ Cursor cr = con.ShowRP(getIntent().getStringExtra("id"));
String[] col = {"PName","RDate","RTime","RNotes"};
int[] dis = {R.id.txtrName, R.id.txtrDate, R.id.txtrTime,R.id.txtrContents}; SimpleCursorAdapter record = new SimpleCursorAdapter(this,
lv=(ListView) findViewById(R.id.listView1);
}
Trang 26Step 12: Choose “Update” to update Pet’s Information
Trang 29private void DisplayPetDetails()
{
new AlertDialog.Builder(this).setTitle("Your Pet Details") setMessage("Pet's Name: "+ PetName.getText().toString()
Trang 30Cmt.getText().toString()+"\n"+
"Owner's Name: "+ Name.getText().toString()+"\n"+ "Address: "+ Address.getText().toString()+"\n"+ "Phone Number: "+ Phone.getText().toString()+"\n"+ "Email: "+ Email.getText().toString())
.setNeutralButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub
} })
.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
getIntent().getStringExtra("id"),
PetName.getText().toString(), PetType.getText().toString(), Gender.getSelectedItem().toString(), PetService.getText().toString(), Start.getText().toString(),
Address.getText().toString(), Phone.getText().toString(), Email.getText().toString() );
Trang 31Information
Trang 32Step 14: Click “Delete” to delete pet’s information
Trang 33Step 15: Click “PhoneGap” Button to access “REGISTER
OWNER’S PROFILE” form
Trang 34<!DOCTYPE HTML>
<html>
<head>
<title>Phonegap</title>
Trang 35<script type="text/javascript" charset="utf-8" 1.5.0.js"></script>
<style type="text/css">
<! style1 {font-size: 12px}
document.myForm.htm_Name.focus();
} else if (document.myForm.htm_ID.value == "") { alert("Please Enter Your Identity Card!!!");
document.myForm.htm_ID.focus();
} else if (document.myForm.htm_Address.value == "") { alert("Please Enter Your Address!!!");
document.myForm.htm_Address.focus();
} else if (document.myForm.htm_Phone.value == "") { alert("Please Enter Your Phone Number!!!");
document.myForm.htm_Phone.focus();
} else if (document.myForm.htm_PetName.value == "") { alert("Please Enter Your Pet's name!!!");
document.myForm.htm_PetName.focus();
} else { alert("Register Success!!!");
} }
function success(){
onDeviceReady();
}
</script>
Trang 36<form action="" name="myForm">
<table width="276" border="1">
<td>Name of the Pet</td>
<td><input name="htm_PetName" type="text" id="htm_PetName"></td>
Trang 38Step 16: After fill full information, we press “Register” Button
to save information and application will send a notification
Trang 39VI EVALUATION
In this Coursework, I had a lot of experience for myself to build an application for Mobile Phone I also tried to find more information on the Internet to build a database, which will store all data when users entered And I choose SQLite Database to perform this task for my application
SQLite Database is compact, simple, easy to query data and doesn’t need to
be installed
In additions, I also refer more information on the Internet to create DatePickerDialog on my application; it allows users easy choose date instead to enter manually
Deadline of this Coursework within a month and I tried to complete it in the shortest time If I had change to do it again, I will try to design application
so make it looks beautiful and more vivid I will also fix mistakes that I made
in this Coursework
VII CONCLUSION
I have completed all requirements of this Coursework, but also some functions are not really perfect.