私のアプリはいくつかのデータを収集できますが、これらのデータを SD カードの txt ファイルに出力したいだけです。
何らかの理由で、次のコードは Galaxy では機能しますが、Nexus では機能しません。コードに何か問題があると思います。
//name of the file
String name = "rawData " + year +
"-" + month + "-" + date + "- " + hour + ":" + minute+ ".txt";
// create a folder stores all the txt file.
File root = new File(Environment.getExternalStorageDirectory(), "rawData");
if (!root.exists()) {
root.mkdirs();
}
// creates a file and a file writer
File gpxfile = new File(root, name);
FileWriter writer = null;
try {
writer = new FileWriter(gpxfile);
Log.d(TAG, "The writer is created");
} catch (IOException e1) {
e1.printStackTrace();
}
Log.d(TAG, "Is the writer null? " + writer);
どうもありがとう!