Created
October 13, 2014 09:56
-
-
Save dp-singh/6085eec2da0c281e0a54 to your computer and use it in GitHub Desktop.
Snippet to store string data in andrdoi
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 Boolean write(String fname, String fcontent) { | |
try { | |
String fpath = "/sdcard/" + fname + ".txt"; | |
File file = new File(fpath); | |
// If file does not exists, then create it | |
if (!file.exists()) { | |
file.createNewFile(); | |
} | |
FileWriter fw = new FileWriter(file.getAbsoluteFile()); | |
BufferedWriter bw = new BufferedWriter(fw); | |
bw.write(fcontent); | |
bw.close(); | |
L.l("Suceess", "Sucess"); | |
return true; | |
} catch (IOException e) { | |
e.printStackTrace(); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment