Application scope for viewmodel

from the CommonsWare Community archives

At December 10, 2020, 2:23pm, Jan asked:

Is there a way to have an application scope on a viewmodel so that it’ll stay around for the life of the application and can be used by all activities? I see in android documentation that a factory can use a store but didn’t really understand all of that.

At December 10, 2020, 2:38pm, mmurphy replied:

Use your own singleton. AFAICT, there would be no benefit in extending ViewModel in your use case.

I cannot rule out there being some way to hack the viewmodel system to allow you to have a ViewModel for your Application, but that seems like a lot of work for no obvious value.