I'm getting voice records from some people. I want to give them id's. I'm trying to save a .txt
file in Android sdcard0 which contains new id value.
I mean, I open the application for new person. Program reads last id value from txt file. And then add +1 value to the new person's id. And update the .txt
file content.
Later I close the application. And then, I open the application again, and read the last id value, and save the another person's voice with person id +1. I want to update .txt
file id's content in Android sdcard0 memory with dynamically every time the application opens.
How can I do that? Please help me. Here is my simple code.
enter cod private String Load() {
String result = null;;
String FILE_NAME = "counter.txt";
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "Records";
File file = new File(baseDir, FILE_NAME);
int counter = 0;
StringBuilder text = new StringBuilder();
try {
FileReader fReader = new FileReader(file);
BufferedReader bReader = new BufferedReader(fReader);
//.....??....
}
result = String.valueOf(text);
} catch (IOException e) {
e.printStackTrace();
}
return result;
}