Update Json File In Android Assets Folder
Solution 1:
So, when the payload is received i want to update a .json file (in the assets folder)
That is not possible. Assets are read-only at runtime.
What you can do is write your new JSON to a file (e.g., getFilesDir()
). Then, adjust your logic that reads in the JSON to look for the file first, falling back to the asset if the file is not available.
Solution 2:
The assets
folder on your development machine is packaged into your APK file when you compile and release your app. On the device at run time, all resources in the assets
folder are read-only because they are loaded from the installed APK. If you want to store data on the machine, then you need to either use a SQLite database or write a local file. See Storage Options in the Android Developer Documentation for more details.
Post a Comment for "Update Json File In Android Assets Folder"