Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SQLite Provider: Database access made easy
Search
David González
January 29, 2014
Technology
350
7
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SQLite Provider: Database access made easy
David González
January 29, 2014
More Decks by David González
See All by David González
A comprehensive guide to tracker protection on Android
malmstein
1
92
Building a Multiplatform library for iOS and Android
malmstein
9
1.3k
Unidirectional Data Flow on Android
malmstein
6
560
Introduction to Kotlin Coroutines
malmstein
0
180
A State Container Architecture for mobile applications
malmstein
0
170
Things I wish I knew before starting to work remote
malmstein
0
100
Remote, lonely and productive
malmstein
0
200
The source of all technical debt
malmstein
6
460
Android Architecture Blueprints
malmstein
0
310
Other Decks in Technology
See All in Technology
Flutterをカメラで動かしたかった話
sony
1
130
AIエージェントを前提としたプラットフォーム エンジニアリング:GKEで作るAgent-Ready Golden Path
legalontechnologies
PRO
2
210
クラウドセキュリティ入門 ~安全なクラウド利用のための基礎知識~
lhazy
11
8.3k
侵入は突然に 〜 IoTマルウェアと悪用される家庭の機器 ~ / When Intrusion Strikes: IoT Malware and the Abuse of Home Devices
nttcom
0
1.5k
Issue設計から始める仕様駆動開発 / 20260731 Mizuki Hirata
shift_evolve
PRO
1
150
AI駆動開発は個人技からチーム戦へ:組織でAIを使いこなすための実践設計
moongift
PRO
0
480
Goでデータパイプラインを作ろう
sansantech
PRO
0
350
初めてのGitHub Actions / GitHub Actions at First
tooppoo
0
150
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
660
20分でわかるセキュアAPI
nwiizo
0
180
【CEDEC2026】ゲームシナリオライターを支援するAIツール開発の実践 ― 設計とプロンプトの工夫 ―
cygames
PRO
1
770
今こそ聞きたいソフトウェア設計 ドメイン駆動設計再入門
masuda220
PRO
17
6.7k
Featured
See All Featured
For a Future-Friendly Web
brad_frost
183
10k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
460
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
160
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Paper Plane
katiecoart
PRO
2
52k
WCS-LA-2024
lcolladotor
0
790
Game over? The fight for quality and originality in the time of robots
wayneb77
1
240
30 Presentation Tips
portentint
PRO
1
360
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
280
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
410
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
How GitHub (no longer) Works
holman
316
150k
Transcript
SQLite Provider: A simplification of database access David Gonzalez
Content Providers Managers of structured data Abstract underlying data storage
Allow external access to data
Manage connection to data source
Easy access to data
Implicit intents
Loader callbacks
Provide data to external apps
PROBLEMS — And we had to fix them
Boilerplate code
DB versioning
JSON to SQL mapping
Create the database public ExampleDatabase(Context context, CursorFactory factory, int version)
{ super(context, DATABASE_NAME, factory, version); } @Override public void onCreate(SQLiteDatabase db) { createDatabase(db); }
protected void createDatabase(SQLiteDatabase db) { final String articleTable = "CREATE
TABLE articles" // + " ('" // + _id + "' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, '" // + title + "' TEXT, '" // + content + "' TEXT, '" // + timestamp + "' TIMESTAMP NOT NULL );"; db.execSQL(articleTable); @Override public void onCreate(SQLiteDatabase db) { createDatabase(db); }
Upgrade it @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) { if (oldVersion == 0) { db.execSQL("DROP TABLE article"); createDatabase(db); } }
Upgrade it ContentResolver resolver = getContentResolver(); String[] projection = new
String[] {UserDictionary.Words._ID, UserDictionary.Words.WORD}; String selectionClause = UserDictionary.Words.WORD + " = ?"; String[] selectionArgs = new String[] {"Android"}; String sortOrder = UserDictionary.Words.WORD + " ASC”; Cursor cursor = resolver.query(UserDictionary.Words.CONTENT_URI, projection, selectionClause, selectionArgs, sortOrder);
Our solution https://github.com/novoda/SQLiteProvider