Closed wongsyrone closed 4 years ago
ContentResolverCompat.query()
returned an null cursor and thus caused the NullPointerException
. There are 4 main causes for this exception:
ContentProvider
does not exist.Uri
which used for querying is invalid.ContentProvider
returns an null cursor in method query()
.RemoteException
is thrown while fetching the ContentProvider
from remote process.In this circumstance, PreferencesProvider
is registed in AndroidManifest.xml
and the uri is ensured to be valid. Also, PreferencesProvider
does not return null in method query()
. So the bug is likely to be caused by the RemoteException
. Do a null-check will help.
Google Pixel 3 XL (crosshatch), 3584MB RAM, Android API 30