How to I read and write a txt file from android 10 and above from internal storage

China☆狼群 提交于 2021-02-05 09:23:29

问题


I've been trying to create an app that reads a TXT file from downloads internal storage and puts it into an ArrayList and writes an excel sheet to downloads internal storage from in android but android 10 isn't allowing me to read or write a file. I have already used Environment.getExternalStorageDirectory() but it keeps getting deprecated. Do you guys have any tips or know anyways out of this.


回答1:


use context.getExternalFilesDir() or context.getExternalCacheDir(),these also work in 10. See https://developer.android.com/training/data-storage



来源:https://stackoverflow.com/questions/59290061/how-to-i-read-and-write-a-txt-file-from-android-10-and-above-from-internal-stora

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!