Android Programming: The Big Nerd Ranch Guide, 2nd Edition
by Bill Phillips, Chris Stewart, Brian Hardy, Kristin Marsicano
External Storage
Your photo needs more than a place on the screen. Full-size pictures are too large to stick inside a SQLite database, much less an Intent. They will need a place to live on your device’s filesystem.
Normally, you would put them in your private storage. Recall that you used your private storage to save your SQLite database. With methods like Context.getFileStreamPath(String) and Context.getFilesDir(), you can do the same thing with regular files, too (which will live in a subfolder adjacent to the databases subfolder your SQLite database lives in).
Table 16.1 Basic file and directory methods in Context
| Method | Purpose |
|---|---|
|
File getFilesDir() |
Returns a handle to the directory for private application ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access