private static void writeToFile ( String text , String logFilePath , boolean isDetailed ) { if ( isSDCardAvailable ( ) && isSDCardWritable ( ) && text != null ) { try { File file = new File ( logFilePath ) ; OutputStream os = new FileOutputStream ( file , true ) ; if ( isDetailed ) { os . write ( ( "---" + new SimpleDateFormat ( "yyyy/MM/dd HH:mm:ss.SSS" ) . format ( Calendar . getInstance ( ) . getTime ( ) ) + "---\n" ) . getBytes ( ) ) ; } os . write ( ( text + "\n" ) . getBytes ( ) ) ; // os.write(("------\n").getBytes()); os . close ( ) ; } catch ( Exception e ) { QuickUtils . log . e ( "Exception" , e ) ; } } else { return ; } }
private write to file method