Android Programming: The Big Nerd Ranch Guide, Third Edition
by Bill Phillips, Chris Stewart, Kristin Marsicano
File 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.
Luckily, you have a place to stash these files: 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).
These are the basic file and directory methods in the Context class:
- 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