Reputation: 309
file = new File(getFilesDir(), "data.txt");
try {
FileOutputStream fos = openFileOutput(fileName, Context.MODE_APPEND);
fos.write(data.getBytes());
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
Is there a way to export this file so I can have access to it? I don't have a SD-card available btw.
Upvotes: 0
Views: 79
Reputation: 3189
File file = new File(Environment.getExternalStorageDirectory()+"/Download/", "yourFile.extension");
This is for downloads directory.
Then to open your file
Intent myIntent = new Intent(Intent.ACTION_VIEW);
myIntent.setData(Uri.fromFile(file));
Intent j = Intent.createChooser(myIntent, "Choose an application to open with:");
startActivity(j);
Upvotes: 1
Reputation: 2706
If you want to get your application path use getFilesDir()
which will give you path /data/data/<your package>/files
So, you can find your file using android file manager in above mentioned directory.
From getFilesDir()
Upvotes: 0