NullPointerException Warning on getView() inside onActivityCreated/onStart/onViewCreated method
问题 I know getView() might return null inside onCreateView() method, but even if I put the below code inside onActivityCreated() , onStart() or onViewCreated() methods, it still shows the warning about a possible NullPointerException in Android Studio (although my program runs without any issue). How to get rid of this warning? I am using Fragments. Code: datpurchased = (EditText) getView().findViewById(R.id.datepurchased); //datpurchased defined as instance variable in the class Warning: Method