Do this way
To store on external storage(SDCARD)
try {
File file = new File(Environment.getExternalStorageDirectory() + File.separator + "Log.txt");
if (!file.exists()) {
file.createNewFile();
}
} catch (Exception e) {
Log.w("tun tun", e.toString());
}
To store In internal storage
try {
File file = new File(context.getCacheDir() + File.separator + "Log.txt");
if (!file.exists()) {
file.createNewFile();
}
} catch (Exception e) {
Log.w("tun tun", e.toString());
}