Skip to content

Instantly share code, notes, and snippets.

@dp-singh
Created October 13, 2014 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dp-singh/6085eec2da0c281e0a54 to your computer and use it in GitHub Desktop.
Save dp-singh/6085eec2da0c281e0a54 to your computer and use it in GitHub Desktop.
Snippet to store string data in andrdoi
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