Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
SQLite Provider: Database access made easy
Search
David González
January 29, 2014
Technology
360
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
Transcript
16 slides
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
More Decks by David González
See All by David González
A comprehensive guide to tracker protection on Android
malmstein
1
120
Building a Multiplatform library for iOS and Android
malmstein
9
1.4k
Unidirectional Data Flow on Android
malmstein
6
580
Introduction to Kotlin Coroutines
malmstein
0
210
A State Container Architecture for mobile applications
malmstein
0
180
Things I wish I knew before starting to work remote
malmstein
0
130
Remote, lonely and productive
malmstein
0
220
The source of all technical debt
malmstein
6
470
Android Architecture Blueprints
malmstein
0
350
Other Decks in Technology
See All in Technology
対話 AI プラットフォーム「アイブリー」で実践する自然言語処理と事業開発
ivry_presentationmaterials
0
220
kubellの最新データ分析環境
kubell_hr
2
290
データ界隈LT祭の運営のふりかえり
yoshimura_datam
0
110
現場に渡し、構造で守る AI エージェントを活用したセルフサーブのデータ基盤の運用
legalontechnologies
PRO
0
170
技術同人誌を作る方法
yoshimura_datam
0
120
AWS初心者のAIエンジニアが、 論文サーベイエージェントを AgentCoreで動かしてみた
dirard12
0
110
[DBRE Summit 26] DBRE はデータベース運用をどう変えたのか
_awache
0
150
SBOM 生成ツールで 2026 Minimum Elements はどこまで満たせるのか
gokken
0
180
専門家に使ってもらうAIプロダクトをつくる - 病院の医事課向けDPCコーディング支援システムの設計と評価
hagino3000
4
1.1k
競馬予想をAIでやってみた話
yoshimura_datam
0
160
テスト自動化の先、テスト自律化に向けて
mineo_matsuya
3
1.1k
一口馬主の募集馬をAIで診断してみた
yoshimura_datam
0
120
Featured
See All Featured
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
410
We Are The Robots
honzajavorek
0
470
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
640
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.2k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
670
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
Believing is Seeing
oripsolob
1
290
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
370
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
500
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Faster Mobile Websites
deanohume
310
32k