Android Mobile Application By Tony Pagaduan .

16
LIFE CLOCK Android Mobile Application By Tony Pagaduan www.MrElte.com
  • 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 .

LIFE CLOCKAndroid Mobile Application

By Tony Pagaduan

www.MrElte.com

Page 2: Android Mobile Application By Tony Pagaduan .

SQLite DB Implementation

Page 3: Android Mobile Application By Tony Pagaduan .

Copy to Excel Spreadsheet

SSA Life Expectancy Table

Excel Spreadsheet

Page 4: Android Mobile Application By Tony Pagaduan .

Creating SQLite DB

SQLite Database Browser Free Software Written in Java

Page 5: Android Mobile Application By Tony Pagaduan .

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 .

Placing SQLite DB into Project

Place SQLite file into Assets Folder

Page 7: Android Mobile Application By Tony Pagaduan .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

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 .

Life Clock Demo

Page 16: Android Mobile Application By Tony Pagaduan .

Life Clock

The End

Thank You

Please Visit

www.MrElte.com

for more information