Category "viewmodel"

Cannot create viewmodel from composalbe function

I have a view model. I am using Hilt. I can create this view model from activity, like this val model: ProfileViewModel by viewModels() However when I try to c

How ViewModel is not get destroyed when activity is rotated

I am curious to know how a ViewModel survives when Activity gets rotated because of that it destroyed and recreated again. Logically If we see then ViewModel ge

Why recomposition happens when call ViewModel in a callback?

I completely confused with compose conception. I have a code @Composable fun HomeScreen(viewModel: HomeViewModel = getViewModel()) { Scaffold { val

Store data and "Cannot create an instance of class ViewModel" - Hilt - Room - JetpackCompose

I try to store some days from ScheduleScreen screen. Lib uses in theme topic. While I was doing this, I had two questions: why i got this error Cannot create an

How to use navGraphViewModels in Activity (Not in Fragment)

In Fragment, we can use ViewModel scoped to navigation Graph. private val viewModel: ViewModel by navGraphViewModels(R.id.youNavGraphID) But how to create View

Composable not recomposing when ViewModel updated from a different Composable

I am developing an Android app using Jetpack Compose. The app shows a list of items. It also has a top bar containing a search bar. We have 3 composable: the li

Android MVVM - How to reference Activity in ViewModel

MVVM architecture, this is my View (Activity): private MyApp app; private MainActivityVM viewModel; @Override protected void onCreate(Bundle savedInstanceSta

Returning BadRequest in method that returns PartialViewResult

I have an MVC5 application that has a method populates and returns a partial view. Since the method accepts an ID as a parameter, Id like to return an error if