Created
August 8, 2014 21:07
-
-
Save jojojames/fe056d65ea8de7ae3df7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File root = Environment.getExternalStorageDirectory(); | |
File dir = new File (root.getAbsolutePath() + "/FlightData"); | |
File file = new File(dir, "FlightData.csv"); | |
file.delete(); | |
dir.delete(); | |
File dir = new File (root.getAbsolutePath() + "/FlightData"); | |
if (!dir.exists()) | |
dir.mkdirs(); | |
file = new File(dir, "FlightData.csv"); | |
FileOutputStream out = null; | |
try { | |
out = new FileOutputStream(file, true); | |
out.write(dataString.getBytes()); | |
} | |
catch (Exception e) { | |
if ( Log.isLoggable(tag, Log.WARN)) | |
Log.w(tag, "Exception trying to save flight data " + dataString, e); | |
} finally { | |
try { | |
if (out !=null) { | |
out.flush(); | |
out.close(); | |
} | |
} catch (IOException e) { | |
Log.w(tag, "Exception trying to close flight data", e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment