What is the most common approach to storing and retreiving data from text files in Java and more specifically in Android projects?
This isn't specific to Android, but you'd want to create a java.io.File
and perhaps use a java.util.Scanner
to read it (if it's text). Otherwise you'll create java.io.InputStream
and work from that.
Depending on what format you want to use and the nature of the data, you can also use things like java.util.Properties
, XML, etc.
See also
- Java Tutorial - Essential Classes - Basic I/O
- I/O Streams
- Byte streams
- Character streams
- Buffered streams
- Scanning and formatting
- I/O Streams
developer.android.com links
package java.io
at developer.android.com- Developer's guide
- Application resources
- Data Storage
- Shared Preferences/Internal Storage/External Storage
- SQLite Databases/Network Connection
精彩评论