Download presentation
Presentation is loading. Please wait.
Published byAudrey Ward Modified over 9 years ago
1
COMP 365 Android Development
2
Manages access from a central database Allows multiple applications to access the same data
4
Each row is an instance of similar data. For example, if your database contains words, each row contains a different word. Each column contains data related to an element. For the above example, the 3 rd column represents how many times each word is used.
5
Implement the Android class ContentProvider Require a means to store complex data/files that applications other than your content provider need access to Require methods to search and sort a large amount of information Need users to copy complex data from your database to other applications
6
File Data Organized data usually stored in files Pictures, Audio and Video files. Structured Data Data stored in an “array” or “table” format Each column represents an aspect of that data Each row represents an element of data
7
An SQLite database An SQLite database API used to store tabular data SQLiteOpenHelper class to create the database SQLiteDatabase to access the database File orientated data Network-based data Synchronizing data from a network source
8
Content URI is the access point for content provider Authority – the symbolic name of the provider If the package name is “com.example.androidContentProvider” The authority by convention will be “com.example.androidContentProvider.provider”
9
Path – the pathname that points to a table or file in your content provider By convention, the pathname to “table1” will be “com.example.androidContentProvider.provider/t able1” Id – Optional, but can point to a specific row in a table.
10
Perform additional operations on more than a single row * : Matches a string of any valid characters of any length # : Matches a string of numeric characters of any length Use the UriMatcher.addURI() and UriMatcher.match(uri) methods to perform actions
11
Abstract class Query – implemented to return search requests from your provider. Must return a Cursor object. Insert – inserts a new row(s) into your database. Update – update a row(s) in your database. Delete – delete one or more rows from your database.
12
GetType – returns the MIME type of the element. OnCreate – implements and creates your content provider on startup. This implementation may change depending on the ContentProvider or SQLiteOpenHelper classes.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.