Skip to content

Instantly share code, notes, and snippets.

@reuniware
Created March 14, 2019 16:45
Show Gist options
  • Save reuniware/3f981835775c4f7f354501e5c0a45a59 to your computer and use it in GitHub Desktop.
Save reuniware/3f981835775c4f7f354501e5c0a45a59 to your computer and use it in GitHub Desktop.
Save a recyclerview adapter in a file in order to get it back (in kotlin)
// Sauvegarde de l'adapter fin de pouvoir appeler notifyDataSetChanged après suppression d'un élément depuis l'adapter, en vue refresh liste
lateinit var adapter: RecyclerView.Adapter<*>
fun saveAdapter(adapterToSave: RecyclerView.Adapter<*>) {
adapter = adapterToSave
}
fun getSavedkAdapter(): RecyclerView.Adapter<*>{
return adapter
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment