How to write in a file declared in res/raw?

前端 未结 2 1458
自闭症患者
自闭症患者 2021-01-23 16:52

I have a file stored in res/raw, and I would like to know how to wite into that file. I tried getResources but it returns an inputStream.

相关标签:
2条回答
  • 2021-01-23 17:07

    You shouldn't be writing your application resources. Instead, try copying the resource to your writable data directory and modifying it there. There a number of methods on Context that will help you find an appropriate directory, depending on your needs.

    0 讨论(0)
  • 2021-01-23 17:24

    Not possible. If you need to copy an asset to the device store the file in the assets directory. Then use the AssetManager to stream in and copy the asset so you can write it to disc or application cache.

    0 讨论(0)
提交回复
热议问题