更新时间:2023-11-22 21:39:46
Take a look this how to use storages in android http://developer.android.com/guide/topics/data/data-storage.html#filesInternal
要从内部存储读取数据,您需要您的app文件文件夹并从此处读取内容
To read data from internal storage you need your app files folder and read content from here
String yourFilePath = context.getFilesDir() + "/" + "hello.txt";
File yourFile = new File( yourFilePath );
您也可以使用这种方法
FileInputStream fis = context.openFileInput("hello.txt");
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader bufferedReader = new BufferedReader(isr);
StringBuilder sb = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
sb.append(line);
}