-1
ファイルに非常に単純なものを保存しようとしています。しかし何らかの理由で最初の66個の呪文を保存するだけです。私は多くの異なるコードを試しましたが、実際には何も動作しません。私の現在のコード:Android保存文字列txtファイル
final String dirPath = Environment.getExternalStorageDirectory().getAbsolutePath();
File dir = new File(dirPath);
if(!dir.exists())
dir.mkdirs();
File file = new File(dirPath, "file.txt");
FileOutputStream stream = null;
try {
stream = new FileOutputStream(file);
stream.write(myString);
stream.flush();
stream.close();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
あなたはそれが働い – Alok