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
340
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
84
Building a Multiplatform library for iOS and Android
malmstein
9
1.3k
Unidirectional Data Flow on Android
malmstein
6
550
Introduction to Kotlin Coroutines
malmstein
0
170
A State Container Architecture for mobile applications
malmstein
0
160
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
450
Android Architecture Blueprints
malmstein
0
300
Other Decks in Technology
See All in Technology
SONiC Scale-Up Working Group から探る Scale-UpやUltraEthernet機能の実装方法
ebiken
PRO
2
470
Bucharest Tech Week 2026 - Guardians of the Cloud-Native Galaxy
edeandrea
PRO
0
130
【FinOps】データドリブンな意思決定を目指して
z63d
0
120
OTel × Datadog で 「AI活用」を計測し、改善に繋げる
shihochan
2
590
脱SaaS!FDEを支えるプロビジョニングと分離設計
knih
0
260
從開發到部署全都交給 AI:實作 AI 驅動的自動化流程
appleboy
0
130
GitHub Copilot app最速の発信の裏側
tomokusaba
1
240
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
170
SONiCの統計情報を取得したい
sonic
0
290
秘密度ラベル初心者が第1歩でつまづかないための「設計・運用」ポイント
seafay
PRO
1
450
AIのReact習熟度を測る
uhyo
2
670
時期が悪い!それでもRaspberry Piを買って遊んで活用するには / 20260627-osc26do-rpi-jikigawarui
akkiesoft
0
730
Featured
See All Featured
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
210
Discover your Explorer Soul
emna__ayadi
2
1.1k
My Coaching Mixtape
mlcsv
0
150
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
400
Everyday Curiosity
cassininazir
0
230
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
480
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
540
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
A better future with KSS
kneath
240
18k
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