I'm trying to create a clock in, clock out app, and thought the best way to go about this would be use a csv file.
//The code below over writes the entire CSV file //what I would like to happen is it appends the persons name and what time they clocked in so I can calcualte their pay at the end
public void onClick(View v) {
Member = clock_In.getTag().toString();
Date currentTime = Calendar.getInstance().getTime();
String text = Member + " "+currentTime;
FileOutputStream fos = null;
try {
fos = openFileOutput(FILENAME, MODE_PRIVATE);
fos.write(text.getBytes());
Toast.makeText(getApplicationContext(), "Saved to "+getFilesDir() + "/" + FILENAME,Toast.LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
}finally {
if (fos!=null ){
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
});