I am getting java.lang.NullPointerException which I think should not be the case. Can anyone help me with it?
I have an interface which is passed to a viewmodel from an activity where its implemented. Then in the viewmodel, it calls the implemented interface method. Inside this method, all I want to do is display a Toast but I am getting null error trying to access the activity context. I do not understand why.
Just to be clear, inside all otber overridden method such as onCreate, onStop, OnResume, etc. If I display the toast, it works fine. Its only when inside this interface method, activity context seems to be null. I have absolutely no idea.