TinyDB--Android-Shared-Preferences-Turbo
TinyDB--Android-Shared-Preferences-Turbo copied to clipboard
Delete object
How to delete the object class values. I use this in putobject. fun putObject(key: String, value: Any, context: Context) { TinyDB(context).putObject(key, value) }
but I need to delete also the object.
you can do that using the remove()
function, Like this:
tinydb.remove(myObjectKey)
;
I can't delete the model class object.
val tinyDB=TinyDB(activity) val statelists = AppConstants.getObject(AppConstants.KEY_OTHERCATEGORY, activity!!, OtheCatResp::class.java as Class<Any>) as? OtheCatResp if(statelists!=null) { Log.w("before size", "" + statelists!!.DATA.size) tinyDB.remove(AppConstants.KEY_OTHERCATEGORY) Log.w("after size", "" + statelists!!.DATA.size) }
but my output W/before size: 100 W/after size: 100