public static int crapToDisk ( Context ctx , String filename , byte [ ] data ) { int code = IO_FAIL ; File dir = Environment . getExternalStorageDirectory ( ) ; File output = new File ( dir , filename ) ; try { FileOutputStream fos = new FileOutputStream ( output ) ; try { fos . write ( data ) ; code = IO_SUCCESS ; } catch ( IOException e ) { code = IO_FAIL ; } finally { fos . close ( ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } return code ; }
Dump Data straight to the SDCard