「reader.txt」のようなAssetsフォルダーのデータストアを使用しています。このデータは、「InputStream」を使用して取得し、このような文字列値をテキストビューの文字列値に設定します。私の質問は、文字列をリストビューに保存する方法ですか?
これが私のコードです:
try {
InputStream is = getAssets().open("reader.txt");
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
// Convert the buffer into a string.
String text = new String(buffer);
TextView tv = (TextView) findViewById(R.id.list);
tv.setText(text);
} catch (IOException e) {
// Should never happen!
throw new RuntimeException(e);
}