Package icyllis.modernui.lifecycle

# Class ViewModelStore

java.lang.Object
icyllis.modernui.lifecycle.ViewModelStore

public class ViewModelStore extends Object
Class to store `ViewModels`.

An instance of `ViewModelStore` must be retained through configuration changes: if an owner of this `ViewModelStore` is destroyed and recreated due to configuration changes, new instance of an owner should still have the same old instance of `ViewModelStore`.

If an owner of this `ViewModelStore` is destroyed and is not going to be recreated, then it should call `clear()` on this `ViewModelStore`, so `ViewModels` would be notified that they are no longer used.

Use `ViewModelStoreOwner.getViewModelStore()` to retrieve a `ViewModelStore` for activities and fragments.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ViewModelStore()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final void`
  `clear()`
  Clears internal storage and notifies ViewModels that they are no longer used.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ViewModelStore

    public ViewModelStore()

- ## Method Details

  - ### clear

    public final void clear()
    Clears internal storage and notifies ViewModels that they are no longer used.