-
Notifications
You must be signed in to change notification settings - Fork 0
/
input3.txt
43 lines (42 loc) · 1.12 KB
/
input3.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package Logger;
import android.os.Environment;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
/**
* Created by AbdulAli on 12/1/2016.
*/
public class Logger {
public static void appendLog(String text)
{
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_MOVIES);
File logFile = new File(path,"/bangash.txt");
if (!logFile.exists())
{
try
{
logFile.createNewFile();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try
{
//BufferedWriter for performance, true to set append to file flag
BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
buf.append(text);
buf.newLine();
buf.close();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}