Created
January 27, 2016 16:18
-
-
Save Domacoski/55969e6ddfe86f6c688f to your computer and use it in GitHub Desktop.
Salvar .txt Android
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
public class Write { | |
public static void writeToFile(String data)throws IOException { | |
FileOutputStream stream = null; | |
try { | |
File root = android.os.Environment.getExternalStorageDirectory(); | |
File dir = new File(root.getAbsolutePath() + "/UBI"); | |
dir.mkdirs(); | |
File file = new File(dir, "LOG_GATEWAY.txt"); | |
stream = new FileOutputStream(file, true); | |
stream.write(data.getBytes()); | |
} finally { | |
if(null != stream){ | |
stream.close(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment