160 likes | 301 Views
Android Mobile Application By Tony Pagaduan www.MrElte.com. Life Clock. SQLite DB Implementation. Copy to Excel Spreadsheet. SSA Life Expectancy Table. Excel Spreadsheet. Creating SQLite DB. SQLite Database Browser Free Software Written in Java. Formatting SQLite DB.
E N D
Android Mobile Application By Tony Pagaduan www.MrElte.com Life Clock
Copy to Excel Spreadsheet SSA Life Expectancy Table Excel Spreadsheet
Creating SQLite DB • SQLite Database Browser • Free Software Written in Java
Formatting SQLite DB • Primary Key of table must be called ‘_id’ • Must create additional Android metadata table
Placing SQLite DB into Project • Place SQLite file into Assets Folder
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
Requesting Data from SQLite DB • Defined Class DataBaseHelper • Extended from SQLiteOpenHelper • Simple SQL Query • “SELECT _id, male FROM life WHERE _id = 22”
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
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 Chart • Every ReDraw : DrawArc is increased by 20 degrees until 360 is reached
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
New Additions to Life Clock • Alert Dialog • Dialog Builder is created • Set a Message • Set an OK Button • Show dialog
New Additions to Life Clock • Haptic Feedback • Phone Vibrates upon Calculation • Utilizes Vibrate Operation • Need to set Vibrate Permissions in AndroidManifest.xml • Function vibrate(20 milliseconds);
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
Life Clock The End Thank You Please Visit www.MrElte.com for more information