Questions regarding applying a Model-View-ViewModel in android application
Questions tagged [android-mvvm]
773 questions
0
votes
1 answer
How to develop application with Android Data Binding Library and MVVM?
I have used Android Data Binding Library, MVVM and Retrofit.
There are two field is called "employeeid" and "password". When I will click on Login Button, I need these value. I have written Button event in LoginViewModel. When I click on Login…

durlove roy
- 229
- 4
- 12
-1
votes
2 answers
Navigate using View Model in Jetpack Compose
Here is my MainActivity.kt file
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
NavigationHoster()
}
here is navhoster function
@Composable
fun NavigationHoster(){
…

Gayantha
- 92
- 8
-1
votes
1 answer
The score I earned on the Game page with .NET MAUI MVVM is not visible on other pages. How can I keep score data in Local device
I want to display the score information I earned on the MultiplicationPage on the GameOverPage. I think I pulled the data from PlayerModal but it still doesn't show up.
GameOverPage.xaml

M3rtix
- 23
- 6
-1
votes
2 answers
crash app when viewmodel read and set data in TextView
I have a simple app that contains a TextView and stores data in a room database When the database contains information, the data is displayed in the text view
problem
When I read the data from the room database and show the first time in the text…

Hosein.m.barazandeh
- 17
- 6
-1
votes
1 answer
How to convert MutableLiveData to Float? Android
I am currently making a Loan Calculator that uses ViewModel to store data between fragments. The app uses EditText and Seekbar user can plot in data and sends it to a shared Viewmodel.
When I try to convert string input from user, I struggle to…

Nicholai Mørch Rindarøy
- 131
- 11
-1
votes
1 answer
Android. Repository from data layer with global lifecycle
I have a project that currently supports MVP and MVVM. Coroutines, hilt, repository pattern are also used.
I need single resources that I will cache.
For example, activity A executes a network request, the user can go to activity B during the…

testivanivan
- 967
- 13
- 36
-1
votes
1 answer
Android kotlin mvvm update live data
How to update mutable live data in kotlin
following is my entity in viewModel
private val searchResult = MutableLiveData>()
following is searchResult pojo
data class SearchResult(
@field:SerializedName("Response")
val…

amodkanthe
- 4,345
- 6
- 36
- 77
-1
votes
1 answer
How to retrive data from DialogFragment with ViewModel and Room
I'm building an Android app that has different pages that mainly have some EditText. My goal is to handle the click on the EditText and shows a DialogAlert with an EditText, then the user can put the text, click "save" and the related field in the…

patana93
- 73
- 1
- 8
-1
votes
1 answer
Android Kotlin Retrofit MVVM return Null
I'm currently making a sample project about diagrams. I'm starting to use MVVM architecture recently, and I got stuck when the response is null. I also checked the Mutable Live Data to make sure that it is calling the API. Here's some of my code and…

XVallerie
- 141
- 2
- 11
-1
votes
1 answer
Stack Overflow error in Repository MVVM architecture
I want to implement MVVM using Room db to my app. I followed this link https://codelabs.developers.google.com/codelabs/android-room-with-a-view/index.html?index=..%2F..index#13
I was getting an error to create an instance of view model. As I solved…

Sid
- 2,792
- 9
- 55
- 111
-1
votes
1 answer
Why repository doesn't notify viewmodel about updated value of variable in spite of implementing LiveData?
I am fetching data from Cloud Firestore and displaying in a recyclerview using MVVM architecture along with LiveData. When I observe the changes in viewmodel and notify the adapter about the dataset change, the changed data isn't updating in the…

Rahul
- 143
- 1
- 17
-1
votes
2 answers
why fragment not showing empty white screen?
I am developing a news app and I have implemented ViewModel in fragment class and getting data in fragment class but it is loading progress bar only not showing data which coming from server
below My MainViewModel.kt
class…

Edgar
- 860
- 1
- 17
- 38
-1
votes
2 answers
How to bind a view model variable with custom class type
What works?
XML:
name="viewModel"
type="com. . . . .MyViewModel" />
...
...
...

Matan Marciano
- 333
- 4
- 13
-1
votes
1 answer
unable to retrieve data of a single row using room database
Unable to get particular record from database getting this output.
My output is :
java.lang.RuntimeException: Unable to start activity ComponentInfo{appwork.com.example/appwork.com.example.MainActivity}: java.lang.NullPointerException: Attempt to…

Manoj Pawar
- 11
- 5
-1
votes
1 answer
Manually creating a foreign key for Android room for a nested array
My json response is:
{
"categories": [
{
"categoryName": "Events",
"entityId": "QwN9goUaw6",
.....
}
],
"entityId": "T1nnwwpjOM"
}
My initial plan was to follow how Google did it in…

Shade
- 45
- 2
- 13