Skip to content
Advertisement

Tag: mvvm

AlertDialog In MVVM

I am building an app in MVVM pattern and I am using 3 different styles of dialogs(some of them have 2 buttons,some of them 3). Since the AlertDialog refers to the view, I wrote the code in the fragment. I have 3 dialogs in the same fragment and its look kind of messy. My questions: Is this a good practice

Why does Retrofit onResponse() is called at last and how can i fix it?

Hello I’m trying to get Weather information by using OpenWeatherAPI. So to connect with OpenWeatherAPI I used Retrofit library. (And also my project is using MVVM Pattern) The problem is that the onResponse() of OpenWeatherRepos is called after the init() of the MainActivityClass is terminated. So OpenWeather is still getting null instances. I don’t know much about API call order

Bind StringProperty to Label from a Singleton

I have a singleton called MenuText. It is responsible for displaying the correct text in the menu. It gets updated dynamically. I have a fxml file, but the MenuText can’t have a reference to it. (This would contradict the MVVM architectural style) Initially I used <fx:define> to setup a reference to the MenuText from the fxml file, but this doesn’t

Class ‘kotlin.reflect.KClass’ is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler

After I converted my java code to Kotlin. There is an issue in this code ViewModelContactUs::class.java in this code part java is in red and does not work and says Returns a Java Class instance corresponding to the given KClass instance. Answer I removed this version below from my app/build/gradle file ext.kotlin_version = ‘1.5.0-M1’ I added this version below from

MVVM – where should I call for user location?

currently, I’m building an app which will show for the user recent forecast. For make an api call, I have to provide longitude and latitude as parameter. For now, I have written some code about getting langitude, and longitude, but I don’t receive proper data. As I written those methods in MainActivity, at first, the longitude, and latitude is equal

MVVM – get context in a Model class

I’m using MVVM to build my Android app and I need to connect the Model to a DB. Instead of Room I’m using the SQLiteOpenHelper and to make a connection to the DB I need the context. But since this is a non activity class I’m struggling to get it. My current solution looks as follows but I keep getting

Advertisement