| 
				
			 | 
			
			
				@@ -0,0 +1,51 @@ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1
			 | 
			
			
				+package com.kfb.kfbv1.model; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				2
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3
			 | 
			
			
				+import android.os.Environment; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				4
			 | 
			
			
				+import android.text.format.Time; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				5
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				6
			 | 
			
			
				+import java.io.BufferedWriter; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7
			 | 
			
			
				+import java.io.File; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				8
			 | 
			
			
				+import java.io.FileWriter; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				9
			 | 
			
			
				+import java.io.IOException; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				10
			 | 
			
			
				+import java.nio.file.FileSystems; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				11
			 | 
			
			
				+import java.nio.file.Path; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				12
			 | 
			
			
				+import java.sql.Timestamp; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				13
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				14
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				15
			 | 
			
			
				+public class LogFile { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				16
			 | 
			
			
				+    public static void appendLog(String text) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				+    { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+        Long tsLong = System.currentTimeMillis(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				+        String ts = tsLong.toString(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				21
			 | 
			
			
				+        text = ts + " - " +text; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				22
			 | 
			
			
				+        String m_path = Environment.getExternalStoragePublicDirectory( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				23
			 | 
			
			
				+                Environment.DIRECTORY_DCIM).getAbsolutePath(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				24
			 | 
			
			
				+        File logFile = new File( m_path+"/kfb.txt"); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+        if (!logFile.exists()) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+        { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+            try 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+            { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+                logFile.createNewFile(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+            } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+            catch (IOException e) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+            { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+                // TODO Auto-generated catch block 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+                e.printStackTrace(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				+            } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				37
			 | 
			
			
				+        try 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+        { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+            //BufferedWriter for performance, true to set append to file flag 
			 | 
		
	
		
			
			| 
				
			 | 
			
				40
			 | 
			
			
				+            BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true)); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+            buf.append(text); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+            buf.newLine(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+            buf.close(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+        catch (IOException e) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+        { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+            // TODO Auto-generated catch block 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+            e.printStackTrace(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+} 
			 |