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;








2















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











share|improve this question
























  • 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


















2















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











share|improve this question
























  • 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














2












2








2








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











share|improve this question
















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








android






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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













1 Answer
1






active

oldest

votes


















6















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.






share|improve this answer

























  • thanks a million!!! So pretty easy!

    – korunos
    Aug 13 '15 at 11:05













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
);



);













draft saved

draft discarded


















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









6















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.






share|improve this answer

























  • thanks a million!!! So pretty easy!

    – korunos
    Aug 13 '15 at 11:05















6















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.






share|improve this answer

























  • thanks a million!!! So pretty easy!

    – korunos
    Aug 13 '15 at 11:05













6












6








6








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.






share|improve this answer
















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.







share|improve this answer














share|improve this answer



share|improve this answer








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

















  • 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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해