I want to ask why we get this annotation:
Method invocation getContext.getContentResolver() may produce NullPointerException
Why i
This usually happens when you call getActivity() or getContext() in a Fragment or DialogFragment to use one of Parent activity methods like getContentResolver() because the compiler is in doubt that these methods may return a null value.
To solve this, instead of using getActivity() or getContext(); you can simply use requireActivity() and requireContext() respectively; these methods assure that a non-null value is returned.
You can take a look on the answer here