How to I read and write a txt file from android 10 and above ...
文章推薦指數: 80 %
use context.getExternalFilesDir() or context.getExternalCacheDir() ,these also work in 10.
Home
Public
Questions
Tags
Users
Collectives
ExploreCollectives
FindaJob
Jobs
Companies
Teams
StackOverflowforTeams
–Collaborateandshareknowledgewithaprivategroup.
CreateafreeTeam
WhatisTeams?
Teams
CreatefreeTeam
CollectivesonStackOverflow
Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost.
Learnmore
Teams
Q&Aforwork
Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch.
Learnmore
HowtoIreadandwriteatxtfilefromandroid10andabovefrominternalstorage
AskQuestion
Asked
1year,11monthsago
Active
1year,11monthsago
Viewed
2ktimes
1
I'vebeentryingtocreateanappthatreadsaTXTfilefromdownloadsinternalstorageandputsitintoanArrayListandwritesanexcelsheettodownloadsinternalstoragefrominandroidbutandroid10isn'tallowingmetoreadorwriteafile.IhavealreadyusedEnvironment.getExternalStorageDirectory()butitkeepsgettingdeprecated.Doyouguyshaveanytipsorknowanywaysoutofthis.
androiddownloadandroid-internal-storage
Share
Follow
editedDec11'19at16:37
TaslimOseni
4,9701010goldbadges3636silverbadges5656bronzebadges
askedDec11'19at16:22
MinatoGrayMinatoGray
2155bronzebadges
Addacomment
|
1Answer
1
Active
Oldest
Votes
0
usecontext.getExternalFilesDir()orcontext.getExternalCacheDir(),thesealsoworkin10.Seehttps://developer.android.com/training/data-storage
Share
Follow
answeredDec11'19at16:48
thorny84thorny84
2366bronzebadges
Addacomment
|
YourAnswer
ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers.
Draftsaved
Draftdiscarded
Signuporlogin
SignupusingGoogle
SignupusingFacebook
SignupusingEmailandPassword
Submit
Postasaguest
Name
Email
Required,butnevershown
PostYourAnswer
Discard
Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy
Nottheansweryou'relookingfor?Browseotherquestionstaggedandroiddownloadandroid-internal-storageoraskyourownquestion.
TheOverflowBlog
Whoownsthisoutage?BuildingintelligentescalationchainsformodernSRE
Podcast395:Whoisbuildingcloudsfortheindependentdeveloper?
FeaturedonMeta
Nowlive:Afullyresponsiveprofile
Reducingtheweightofourfooter
TwoBornottwoB-Farewell,BoltClockandBhargav!
Linked
1
HowcanIlistallthefilesindirectoryusingMedistore(Android10/Q)?
0
HowtoreadallthefilesinafolderwithMediatoreAPIinAndroidQ(10)?
Related
3057
HowtostopEditTextfromgainingfocusatActivitystartupinAndroid
1102
DownloadafilewithAndroid,andshowingtheprogressinaProgressDialog
1204
HowtogetcurrenttimeanddateinAndroid
2
ReadanArrayListfromInternalStorage
1
Excelfileaccessfrominternalstorageandroidapp
1
Android-readfilefrominternalstoragepublicfolder
0
Howtosaveanaudiorecordedininternalstorage
0
Readfilesfrommyinternalstorageandroidphone6.0.0
1
Downloadexternal.dbfileforread-onlyuseinKotlinAndroidapplication?
0
Gettheuserselectedfile'snameandpathirrespectiveofitslocation[eitherininternalorexternalmemory]inAndroid?
HotNetworkQuestions
Whydopeoplecaresomuchabout'linearresponsetheory'?
Harmonicdivisornumbers
Anunwaveringforce...Whatdoyouget?
Whyarecerealgrainssoimportanttoagricultureandcivilization?
compassandstraightedgeinacientGreek?
What'sconsideredabadabilitycheckroll?Is10abadroll?
Howtoaligntexttothetopofatabularcell?
InthesecondDeathlyHallowsfilm,didHarrychangeclotheswhileSnapeandMcGonagallwerefighting?
Doestheabbreviation“ſ.”inthis1755workmean“sine”?
HowtoannotatestaffwithbeatnumbersinLilypond?
HowdoesoneplayaChaoticEvilcharacterwithoutdisruptingtheplaygroup?
WhatshouldIdoideallytorechargeduringaPhD?
HowshouldIteachlogarithmstohighschoolstudents?
RuyLopez-whydoesBlacknottakee4?
MethodforcreateacopyofList
延伸文章資訊
- 1How to read text file in android - Read from any folder internal & external
- 2Android 10 & 11 storage cheat sheet | by Petros Douvantzis
It can read files created by other apps. You can't write to a random folder in the internal stora...
- 3Data and file storage overview | Android Developers
READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE when accessing other apps' files on Android 10 (A...
- 4Android File IO Tutorial with Internal and External Storage
No permissions are required to read or write files to internal storage for your ... For apps the ...
- 5Storage updates in Android 11