Android webinar class_6

663 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
663
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • such as development toolkits for other programming languages, and can write and contribute their own plug-in modules.
  • such as development toolkits for other programming languages, and can write and contribute their own plug-in modules.
  • Android webinar class_6

    1. 1. SQLite Database
    2. 2. What is SQLite?• Open Source Database• SQLite is available on every Android device• It supports standard relational database features like – SQL syntax – transactions – SQL statements
    3. 3. Advantages of Using SQLite• Very light weight database• Requires very little memory – Approx. 250KB• SQLite Database is automatically managed by Android Platform
    4. 4. SQLite Data Types
    5. 5. SQLite Data Types• SQLite supports only three data types – TEXT (like String) – INTEGER (like int) – REAL (like double)• SQLite itself does not validate the data types
    6. 6. SQLiteOpenHelper
    7. 7. SQLiteOpenHelper Class• It is a helper class used to manage database creation and version management• We override the onCreate() and onUpgrade() methods in this class• These methods are automatically called by the framework
    8. 8. SQLiteOpenHelper Class• onCreate()• This method is called – if the database does not exists• onUpgrade()• This method is called – if the database version is increased
    9. 9. SQLiteDatabase
    10. 10. SQLiteDatabase Class• SQLiteDatabase is the base class for working with a SQLite database• It provides various methods like : – Open() – Insert() – Update() – Close()
    11. 11. Content Values
    12. 12. ContentValues• ContentValues are used to insert or update database entries• Records are stored as key-value pair in ContentValues• Where : – Key represents Column-Id – Value represents data for the Column-Id
    13. 13. Cursor
    14. 14. Cursor• A query returns a Cursor object• This Cursor points to a single row of the result fetched by the query• Benefit : – No need to load all data into memory
    15. 15. Using the Content Providers
    16. 16. Content Providers-What are they• A content provider manages access to a central repository of data.• content providers are primarily intended to be used by other applications, which access the provider using a provider client object.• An application accesses the data from a content provider with a ContentResolver client object
    17. 17. Content Providers Continued:• The ContentProvider uses the path part of the content URI to choose the table to access• Add a content provider uses permission to the manifest• Provides methods to insert,update,delete,query
    18. 18. Coding Example : Demo Application !
    19. 19. •Q & A..?

    ×