I have a question and I want to hear an answer for this cause I really search it for a long time and it really doesn't matter what I'm doing I still get the error. Here is the code that I wrote :
if (getContext() != null) {
if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {}
Before I try to load the Map I'm checking the permission for he Locations so inside onMapLoaded I'm checking like above.
Is there any tricks or is this a bug in ContextCompat ?
Error:
Attempt to invoke virtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)' on a null object reference