384 questions
How to clear a text file in a directory using android java?
soLo Lz
41
Reputation points
This code will export table tranpbilmonsms to text file tranpbilmonsms.txt. How do you clear the text inside the text file in a directory? text file file must clear first before I inserted the text from the table.. Thank you.
THIS IS THE CODE:
public void onExportTxt(View view) {
databaseAccess.open();
try {
'Insert HERE the code that will clear tranpbilmonssms.txt' databaseAccess.exportToTxt(Environment.getExternalStorageDirectory().getPath() + "/tranpbilmonsms.txt","tranpbilmonsms"); Toast.makeText(this, "Successfully export to txt.", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e("Error", e.getMessage());
Toast.makeText(this, "Failed to export to txt.", Toast.LENGTH_SHORT).show();
}
databaseAccess.close();
}
Microsoft Security Intune Microsoft Intune Android
Sign in to answer