Skip to content Skip to sidebar Skip to footer

Recyclerview Save Elements In Json

I have recyclerview (in fragment) and fragment with details information to one of the element. All is good, but when my data was saved. I have bad results in my JSON file. All time

Solution 1:

When opening the OutputStream for writing into the file, you're using the Context.MODE_APPEND flag, which is causing the write operation to append and not overwrite as you intended, change it to:

OutputStream out = mContext.openFileOutput(mFilename, 0);

Also, there was no need to mention the RecyclerView at all, since it has nothing to do with the problem at hand.

Post a Comment for "Recyclerview Save Elements In Json"