Findviewbyid Throws Null When Called Through An Object
I have a function in main.java that uses some UI elements like spinner to textview. public void updateNearByPeople() { reportEventPeopleAroundSpinner = (Spinner) findViewBy
Solution 1:
Main mainObj=new Main();
you can't do that. The activity needs to go through its lifecycle, to build up its view hierarchy. If you just instantiate it through the new operator, neither its onAttach or onCreate method will be called. It means that you can not access resources and views as well
Post a Comment for "Findviewbyid Throws Null When Called Through An Object"