Replace openFileOutput to save Files in subdirectoryCreating files in sub directories in androidHow to save an Android Activity state using save instance state?Fling gesture detection on grid layoutHow to Remove all debug logging calls before publishing app to Google Play?Creating files in sub directories in androidSaving int/byte/string data types in AndroidHow to avoid reverse engineering of an APK file?Android: Is it possible to create a media file using openFileOutput functionMipmap drawables for iconsCalling OpenFileOutput inside a Button click listener in AndroidIs it possible to create a private but persistent file?
What do you call the action of someone tackling a stronger person?
Why cruise at 7000' in an A319?
Can you get infinite turns with this 2 card combo?
How would a order of Monks that renounce their names communicate effectively?
Wilcoxon signed rank test – critical value for n>50
How can I create ribbons like these in Microsoft word 2010?
Short story with brother-sister conjoined twins as protagonists?
How hard is it to sell a home which is currently mortgaged?
How can I convince my reader that I will not use a certain trope?
Prof. Roman emails his Class this unusual Math Quiz ahead of
Was "I have the farts, again" broadcast from the Moon to the whole world?
C-152 carb heat on before landing in hot weather?
Alphabet completion rate
How to convert object fill in to fine lines?
How to determine what is the correct level of detail when modelling?
Set vertical spacing between two particular items
How can I check type T is among parameter pack Ts... in C++?
If protons are the only stable baryons, why do they decay into neutrons in positron emission?
Magnitude of vector quantities
Anagram Within an Anagram!
Does the UK have a written constitution?
Was touching your nose a greeting in second millenium Mesopotamia?
Dold-Kan correspondence in the category of symmetric spectra
Why aren't (poly-)cotton tents more popular?
Replace openFileOutput to save Files in subdirectory
Creating files in sub directories in androidHow to save an Android Activity state using save instance state?Fling gesture detection on grid layoutHow to Remove all debug logging calls before publishing app to Google Play?Creating files in sub directories in androidSaving int/byte/string data types in AndroidHow to avoid reverse engineering of an APK file?Android: Is it possible to create a media file using openFileOutput functionMipmap drawables for iconsCalling OpenFileOutput inside a Button click listener in AndroidIs it possible to create a private but persistent file?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have used many times openFileOutput.
Example:
FileOutputStream fileOutputStream = openFileOutput(fileName, Context.MODE_PRIVATE);
Now I noticed that all the files using openFileOutput method will be placed in the private app files directory.
It looks like:
/data/data/com.my.app.app/files/example.txt
How can I replace this method to store the Files on subdirectory?
Example:
/data/data/com.my.app.app/files/subdirectory/example.txt
add a comment |
I have used many times openFileOutput.
Example:
FileOutputStream fileOutputStream = openFileOutput(fileName, Context.MODE_PRIVATE);
Now I noticed that all the files using openFileOutput method will be placed in the private app files directory.
It looks like:
/data/data/com.my.app.app/files/example.txt
How can I replace this method to store the Files on subdirectory?
Example:
/data/data/com.my.app.app/files/subdirectory/example.txt
There is nothing from stopping you creating directories in your private app space. You can use the standard File class. See stackoverflow.com/questions/3458008/…
– Byron
Aug 12 '15 at 12:56
add a comment |
I have used many times openFileOutput.
Example:
FileOutputStream fileOutputStream = openFileOutput(fileName, Context.MODE_PRIVATE);
Now I noticed that all the files using openFileOutput method will be placed in the private app files directory.
It looks like:
/data/data/com.my.app.app/files/example.txt
How can I replace this method to store the Files on subdirectory?
Example:
/data/data/com.my.app.app/files/subdirectory/example.txt
I have used many times openFileOutput.
Example:
FileOutputStream fileOutputStream = openFileOutput(fileName, Context.MODE_PRIVATE);
Now I noticed that all the files using openFileOutput method will be placed in the private app files directory.
It looks like:
/data/data/com.my.app.app/files/example.txt
How can I replace this method to store the Files on subdirectory?
Example:
/data/data/com.my.app.app/files/subdirectory/example.txt
edited Aug 12 '15 at 12:53
korunos
asked Aug 12 '15 at 12:24
korunoskorunos
3381 gold badge8 silver badges24 bronze badges
3381 gold badge8 silver badges24 bronze badges
There is nothing from stopping you creating directories in your private app space. You can use the standard File class. See stackoverflow.com/questions/3458008/…
– Byron
Aug 12 '15 at 12:56
add a comment |
There is nothing from stopping you creating directories in your private app space. You can use the standard File class. See stackoverflow.com/questions/3458008/…
– Byron
Aug 12 '15 at 12:56
There is nothing from stopping you creating directories in your private app space. You can use the standard File class. See stackoverflow.com/questions/3458008/…
– Byron
Aug 12 '15 at 12:56
There is nothing from stopping you creating directories in your private app space. You can use the standard File class. See stackoverflow.com/questions/3458008/…
– Byron
Aug 12 '15 at 12:56
add a comment |
1 Answer
1
active
oldest
votes
How can I replace this method to store the Files on subdirectory?
Replace:
FileOutputStream fileOutputStream = openFileOutput(fileName, Context.MODE_PRIVATE);
with:
File dir=new File(getFilesDir(), dirName);
dir.mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(new File(dir, fileName));
where dirName is the name of your desired subdirectory.
thanks a million!!! So pretty easy!
– korunos
Aug 13 '15 at 11:05
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31965166%2freplace-openfileoutput-to-save-files-in-subdirectory%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
How can I replace this method to store the Files on subdirectory?
Replace:
FileOutputStream fileOutputStream = openFileOutput(fileName, Context.MODE_PRIVATE);
with:
File dir=new File(getFilesDir(), dirName);
dir.mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(new File(dir, fileName));
where dirName is the name of your desired subdirectory.
thanks a million!!! So pretty easy!
– korunos
Aug 13 '15 at 11:05
add a comment |
How can I replace this method to store the Files on subdirectory?
Replace:
FileOutputStream fileOutputStream = openFileOutput(fileName, Context.MODE_PRIVATE);
with:
File dir=new File(getFilesDir(), dirName);
dir.mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(new File(dir, fileName));
where dirName is the name of your desired subdirectory.
thanks a million!!! So pretty easy!
– korunos
Aug 13 '15 at 11:05
add a comment |
How can I replace this method to store the Files on subdirectory?
Replace:
FileOutputStream fileOutputStream = openFileOutput(fileName, Context.MODE_PRIVATE);
with:
File dir=new File(getFilesDir(), dirName);
dir.mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(new File(dir, fileName));
where dirName is the name of your desired subdirectory.
How can I replace this method to store the Files on subdirectory?
Replace:
FileOutputStream fileOutputStream = openFileOutput(fileName, Context.MODE_PRIVATE);
with:
File dir=new File(getFilesDir(), dirName);
dir.mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(new File(dir, fileName));
where dirName is the name of your desired subdirectory.
edited Mar 25 at 11:41
answered Aug 12 '15 at 13:12
CommonsWareCommonsWare
796k143 gold badges1931 silver badges1974 bronze badges
796k143 gold badges1931 silver badges1974 bronze badges
thanks a million!!! So pretty easy!
– korunos
Aug 13 '15 at 11:05
add a comment |
thanks a million!!! So pretty easy!
– korunos
Aug 13 '15 at 11:05
thanks a million!!! So pretty easy!
– korunos
Aug 13 '15 at 11:05
thanks a million!!! So pretty easy!
– korunos
Aug 13 '15 at 11:05
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31965166%2freplace-openfileoutput-to-save-files-in-subdirectory%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
There is nothing from stopping you creating directories in your private app space. You can use the standard File class. See stackoverflow.com/questions/3458008/…
– Byron
Aug 12 '15 at 12:56