Mark Barr
- Forum posts: 4
Mar 13, 2014, 1:04:55 AM via Website
Mar 13, 2014 1:04:55 AM via Website
Guys
Excuse my ignorance nut im prettyy new to this
Im trying to write a string to a text file on the phone internal storage
i use the following code
protected void writefile() {
String FILENAME = "filedemo.txt";
String content = txtMessage.getText().toString();
try {
FileOutputStream fos = openFileOutput(FILENAME,MODE_PRIVATE);
fos.write(content.getBytes());
fos.close();
Toast.makeText(this, "File Saved",Toast.LENGTH_SHORT).show();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}}
I understand this writes it to the internal storage in data/data but I want it to store in a folder called "Datafiles" which I can access via my PC or using a file manager
any ideas how i do this?
Your help greatly appreciated
Mark
Excuse my ignorance nut im prettyy new to this
Im trying to write a string to a text file on the phone internal storage
i use the following code
protected void writefile() {
String FILENAME = "filedemo.txt";
String content = txtMessage.getText().toString();
try {
FileOutputStream fos = openFileOutput(FILENAME,MODE_PRIVATE);
fos.write(content.getBytes());
fos.close();
Toast.makeText(this, "File Saved",Toast.LENGTH_SHORT).show();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}}
I understand this writes it to the internal storage in data/data but I want it to store in a folder called "Datafiles" which I can access via my PC or using a file manager
any ideas how i do this?
Your help greatly appreciated
Mark
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.