android development beyond the basics

15
Android Development Beyond the Basics S.Vanjikumaran

Upload: vanjikumaran-sivajothy

Post on 23-Jun-2015

98 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Android development   beyond the basics

Android DevelopmentBeyond the Basics

S.Vanjikumaran

Page 2: Android development   beyond the basics

Saving the Data

● Most Android apps need to save data!! even if only to save information about the app state during onPause() so the user's progress is not lost.

● Most non-trivial apps also need to save user settings, and some apps must manage large amounts of information in files and databases.

Page 3: Android development   beyond the basics

Saving Key-Value Sets

● If you have a relatively small collection of key-values that you'd like to save, you should use the SharedPreferences APIs.

Page 4: Android development   beyond the basics

Saving Files

● Android uses a file system that's similar to disk-based file systems on other platforms. This lesson describes how to work with the Android file system to read and write files with the File APIs.

Page 5: Android development   beyond the basics

Saving Data in SQL Database

● Saving data to a database is ideal for repeating or structured data, such as contact information. This class assumes that you are familiar with SQL databases in general and helps you get started with SQLite databases on Android. The APIs you'll need to use a database on Android are available in the android.database.sqlite package.

Page 6: Android development   beyond the basics

What is SQLite?

● SQLite is an Open Source Database● supports standard relational database

features● It requires only little memory at runtime● SQLite supports the data types

Page 7: Android development   beyond the basics

SQLite in Android

● SQLite is available on every Android device● SQLite database in android does not require

any database setup

Page 8: Android development   beyond the basics

SQLite Architecture

Page 9: Android development   beyond the basics

SQL 101

● DML● DDL

Page 10: Android development   beyond the basics

First Ever Database in Android

● What you need to know?○ android.database.sqlite package

Page 11: Android development   beyond the basics

First Ever Database in Android

● Defines the table name and column names for a single table

Page 12: Android development   beyond the basics

First Ever Database in Android

● Create a Database Using a SQL Helper

Page 13: Android development   beyond the basics

First Ever Database in Android

● Insert data into the database by passing a ContentValues object to the insert() method

Page 14: Android development   beyond the basics

First Ever Database in Android

● Read Information from a Database

Page 15: Android development   beyond the basics

First Ever Database in Android

● When you need to modify a subset of your database values, use the update() method.