Android Mobile Application By Tony Pagaduan .
-
date post
21-Dec-2015 -
Category
Documents
-
view
213 -
download
0
Transcript of Android Mobile Application By Tony Pagaduan .
![Page 1: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/1.jpg)
LIFE CLOCKAndroid Mobile Application
By Tony Pagaduan
www.MrElte.com
![Page 2: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/2.jpg)
SQLite DB Implementation
![Page 3: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/3.jpg)
Copy to Excel Spreadsheet
SSA Life Expectancy Table
Excel Spreadsheet
![Page 4: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/4.jpg)
Creating SQLite DB
SQLite Database Browser Free Software Written in Java
![Page 5: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/5.jpg)
Formatting SQLite DB
Primary Key of table must be called ‘_id’ Must create additional Android metadata table
![Page 6: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/6.jpg)
Placing SQLite DB into Project
Place SQLite file into Assets Folder
![Page 7: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/7.jpg)
Copying SQLite file to Android System
Every time App is opened Checks if a database exists on Android System
If not: The SQLite file is copied from Assets Folder to the Android System○ Using ByteSteam Operations○ SQLite file coping process happens only once
![Page 8: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/8.jpg)
Requesting Data from SQLite DB
Defined Class DataBaseHelper Extended from SQLiteOpenHelper
Simple SQL Query “SELECT _id, male FROM life WHERE _id = 22”
![Page 9: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/9.jpg)
Updated Life Clock Calculation
Everyone is familiar with using “78.4” years with their project, instead use getLifeExp function
getLifeExp( age , gender ) returns specific life expectancy
Add/Apply new life expectancy years to current date instead of birthdate
![Page 10: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/10.jpg)
New Additions to Life Clock Animated Pie Chart
Utilizes Threads and Handlers Operations
Thread sends a message to Handler every 1/10 second
Handler ReDraws Pie ChartEvery ReDraw : DrawArc is increased by 20
degrees until 360 is reached
![Page 11: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/11.jpg)
New Additions to Life Clock Menu Button
Need to define an XML layout○ Put xml file into “menu” folder
Override Functions in Activity○ onCreateOptionsMenu○ onOptionsItemSelected
On Selection it creates a Dialog
![Page 12: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/12.jpg)
New Additions to Life Clock Alert Dialog
Dialog Builder is createdSet a MessageSet an OK ButtonShow dialog
![Page 13: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/13.jpg)
New Additions to Life Clock Haptic Feedback
Phone Vibrates upon CalculationUtilizes Vibrate Operation
○ Need to set Vibrate Permissions in AndroidManifest.xml
○ Function vibrate(20 milliseconds);
![Page 14: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/14.jpg)
New Additions to Life Clock Shake to Calculate
Shake phone to start calculations Utilizes Accelerometer
○ Set a Listener in SensorManager○ Gravity is always acting on phone○ Must calculate change in momentum
If momentum is greater than 5 units: start calculation
![Page 15: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/15.jpg)
Life Clock Demo
![Page 16: Android Mobile Application By Tony Pagaduan .](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d545503460f94a30a86/html5/thumbnails/16.jpg)
Life Clock
The End
Thank You
Please Visit
www.MrElte.com
for more information