COMP1661_Application Development For Mobile Devices
APPLICATION DEVELOPMENT
FOR MOBILE DEVICES
MOBIPAWS APPLICATION
(REPORT DOCUMENT)
Student Name:
LY DUONG TUAN ANH
Student ID:
000808060
Submission Date: 11/11/2014
Report Document / Student Name: LY DUONG TUAN ANH
1
COMP1661_Application Development For Mobile Devices
Contents
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
/> /> />p6iPUiGfbicAWrfXnrgfldwDgZyp
/>bicAWrfXnrgfldwDgZyp&index=9
/>basetut.com/sqlite-trong-android-part-1/
Report Document / Student Name: LY DUONG TUAN ANH
2
COMP1661_Application Development For Mobile Devices
I. 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
FEATURE
IMPLEMENTATION
A
B
C
D
Fully implementation
Fully implementation
Fully implementation
I only did PhoneGap on the
feature.
Report Document / Student Name: LY DUONG TUAN ANH
3
COMP1661_Application Development For Mobile Devices
III. BUG LIST
Features
A
Bug list
Only check Blank for each
attributes, not check input type
of email (example:
)
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.
Report Document / Student Name: LY DUONG TUAN ANH
4
COMP1661_Application Development For Mobile Devices
V. SCREENSHOTS
Report Document / Student Name: LY DUONG TUAN ANH
5
COMP1661_Application Development For Mobile Devices
Step 1: Click “Add New” Button to input Pet’s information
and the code of HomeMainActivity.java
Report Document / Student Name: LY DUONG TUAN ANH
6
COMP1661_Application Development For Mobile Devices
Report Document / Student Name: LY DUONG TUAN ANH
7
COMP1661_Application Development For Mobile Devices
public void getStartDate()
{
Istart=(ImageButton) findViewById(R.id.ibtnStart);
}
public void getDate()
Report Document / Student Name: LY DUONG TUAN ANH
8
COMP1661_Application Development For Mobile Devices
{
cal=Calendar.getInstance();
SimpleDateFormat sdf=null;
sdf=new SimpleDateFormat("dd/MM/yyyy",Locale.getDefault());
String strDate=sdf.format(cal.getTime());
txt = strDate;
dateChoose=cal.getTime();
}
public void showStartDate()
{
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);
cal.set(year, month, day);
dateChoose=cal.getTime();
}
};
String s=txt;
String strArrtmp[]=s.split("/");
int d=Integer.parseInt(strArrtmp[0]);
int m=Integer.parseInt(strArrtmp[1])-1;
int y=Integer.parseInt(strArrtmp[2]);
DatePickerDialog pic=new DatePickerDialog(
PetHome.this,
callback, y, m, d);
pic.setTitle("Please choose Start date");
pic.show();
}
Step 2: After input Pet’s Information, click “Insert” Button to
continue and code of “Start Date” ImageButton.
Report Document / Student Name: LY DUONG TUAN ANH
9
COMP1661_Application Development For Mobile Devices
private void DisplayPetDetails()
{
loaddata();
new AlertDialog.Builder(this).setTitle("Your Pet Details")
.setMessage("Pet's Name: "+ PetName.getText().toString() +"\n"+
Report Document / Student Name: LY DUONG TUAN ANH
10
COMP1661_Application Development For Mobile Devices
"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() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
})
.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
long i = Con.INSERT_NewInformation(
PetName.getText().toString(),
PetType.getText().toString(),
Gender.getSelectedItem().toString(),
PetService.getText().toString(),
Start.getText().toString(),
End.getText().toString(),
Cmt.getText().toString(),
Name.getText().toString(),
Address.getText().toString(),
Phone.getText().toString(),
Email.getText().toString() );
if(i>=0)
{
Toast.makeText(getApplicationContext(), "Insert Success!!!",
Toast.LENGTH_LONG).show();
PetName.setText("");
PetType.setText("");
PetService.setText("");
Start.setText("");
End.setText("");
Cmt.setText("");
Name.setText("");
Address.setText("");
Phone.setText("");
Email.setText("");}
else
{
Toast.makeText(getApplicationContext(), "Insert Fail!!!",
Toast.LENGTH_LONG).show();
}}}).show();}
Report Document / Student Name: LY DUONG TUAN ANH
11
COMP1661_Application Development For Mobile Devices
Step 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.
Report Document / Student Name: LY DUONG TUAN ANH
12
COMP1661_Application Development For Mobile Devices
Step 4: After click “Confirm” Button, application will show a
notification and data was inserted.
Report Document / Student Name: LY DUONG TUAN ANH
13
COMP1661_Application Development For Mobile Devices
Step 5: Click “Search” Button to implement Search function
of application.
Report Document / Student Name: LY DUONG TUAN ANH
14
COMP1661_Application Development For Mobile Devices
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.viewdetails);
con =new Controller(this);
Report Document / Student Name: LY DUONG TUAN ANH
15
COMP1661_Application Development For Mobile Devices
btnsearch=(Button) findViewById(R.id.btnsearch);
lv=(ListView) findViewById(R.id.list);
btnsearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
RadioButton ra=(RadioButton) findViewById(
rg.getCheckedRadioButtonId());
final String radioname = ra.getText().toString();
EditText esearch = (EditText) findViewById(R.id.txtsearch);
final String sname = esearch.getText().toString();
if(radioname.equals("Name of Owner")){
showdata(sname,"OName");} else{
showdata(sname,"PName");
}}});
// DIALOG
final ListView lv1 = (ListView) findViewById(R.id.list);
lv1.setOnItemLongClickListener(new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int pos, long id) {
// TODO Auto-generated method stub
TextView et=(TextView) arg1.findViewById(R.id.txtPID);
session1=et.getText().toString();
TextView ev=(TextView) arg1.findViewById(R.id.txtPName);
session2=ev.getText().toString();
Dialog(et.getText().toString(), ev.getText().toString());
return true;
}});
Step 6: Click “Search” Button to search by Pet’s Name or
Owner’s Name.
Report Document / Student Name: LY DUONG TUAN ANH
16
COMP1661_Application Development For Mobile Devices
private void Dialog(final String id, final String name)
{
new AlertDialog.Builder(this)
.setTitle("Menu")
.setItems(R.array.Menu,
new DialogInterface.OnClickListener()
Report Document / Student Name: LY DUONG TUAN ANH
17
COMP1661_Application Development For Mobile Devices
{
public void onClick(DialogInterface dialoginterface,int i)
{
if(i==2){
Intent it = new Intent(getApplicationContext(), UpdateActivity.class);
it.putExtra("id", id);
startActivity(it);
}else if(i==0){
DisplayPetDetails(session1);
}else if(i==3){
con.DELETE_PetInformation(id);
showdata("","OName");
}else if(i==1){
Intent rp= new Intent(getApplicationContext(), ReportActivity.class);
rp.putExtra("id", id);
rp.putExtra("name", name);
startActivity(rp);
}}})
.show();
}
Step 7: Press and Hold result after we search, a Menu will be
show, Click “Detail” to view Pet’s Detail
Report Document / Student Name: LY DUONG TUAN ANH
18
COMP1661_Application Development For Mobile Devices
private void DisplayPetDetails(String id)
{
Vector v = con.SearchDetail(id);
new AlertDialog.Builder(this).setTitle("Your Pet Details")
.setMessage("Pet's Name: "+ v.get(0).toString() +"\n"+
Report Document / Student Name: LY DUONG TUAN ANH
19
COMP1661_Application Development For Mobile Devices
"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() {
@Override
public void onClick(DialogInterface dialog, int which) {}}).show();
Step 8: This is Pet’s Detail, then we click “Close” to return
Menu
Report Document / Student Name: LY DUONG TUAN ANH
20
COMP1661_Application Development For Mobile Devices
Step 9: Click “Report” to create report for pet.
Report Document / Student Name: LY DUONG TUAN ANH
21
COMP1661_Application Development For Mobile Devices
Step 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
Report Document / Student Name: LY DUONG TUAN ANH
22
COMP1661_Application Development For Mobile Devices
private class ButtonEvent implements OnClickListener
{
@Override
public void onClick(View v) {
switch(v.getId())
{
case R.id.btnClear:
Intent a= new Intent(getApplicationContext(),
ShowDetailActivity.class);
startActivity(a);
break;
case R.id.btnView:
Intent b= new Intent(getApplicationContext(),
ShowReportActivity.class);
b.putExtra("id", getIntent().getStringExtra("id"));
startActivity(b);
break;
case R.id.btnReport:
loadata();
if(Contents.getText().toString().equals(""))
{
Toast.makeText(getApplicationContext(), "Report Fail!!!",
Toast.LENGTH_LONG).show();
}
else
{
long i = control.INSERT_NewReport(
getIntent().getStringExtra("id"),
DateReport.getText().toString(),
TimeReport.getText().toString(),
Contents.getText().toString());
Toast.makeText(getApplicationContext(), "Report
Success!!!", Toast.LENGTH_LONG).show();
}
break;
}}}
Report Document / Student Name: LY DUONG TUAN ANH
23
COMP1661_Application Development For Mobile Devices
Step 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
Report Document / Student Name: LY DUONG TUAN ANH
24
COMP1661_Application Development For Mobile Devices
private 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,
R.layout.reportlist,cr, col, dis);
lv=(ListView) findViewById(R.id.listView1);
lv.setAdapter(record);
}
Report Document / Student Name: LY DUONG TUAN ANH
25