Save a (.txt) file to the Assets Folder in Android?

♀尐吖头ヾ 提交于 2019-11-28 21:21:07

You can't. The assets folder is read-only at runtime.

Pick a different location to save your data, see Data Storage for more information.

The path of assets folder is file:///android_asset But this is read-only.

The assets folder is like folders res, src, gen, etc. These are all useful to provide different files as input to build system to generate APK file for your app.

All these are read-only while your app is running. At run-time you can only write to SD card.

I hope you understand my answer.

Not possible,

Better you choose internal storage to save your txt file. Internal Storage. Hope this will help you to understand.

No you can't do this, because of if you read and write both at runtime then everything could be change and application will behave unexpected which could be harmful or may be crashed. i suggest you to use internal memory, sqlite and app SharedPreferences etc.

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