public static File createTempFile ( Context c , File root , String filename , String extension ) { File output = null ; try { if ( filename != null ) { if ( ! extension . contains ( "." ) ) extension = "." + extension ; output = new File ( root , filename + extension ) ; output . createNewFile ( ) ; //output = File.createTempFile(filename, extension, root); Log . i ( TAG , "Created temp file: " + output . getAbsolutePath ( ) ) ; } return output ; } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; } }
Returns a TempFile with given root filename and extension . The resulting TempFile is safe for use with Android s MediaRecorder