Closed jayeshbabuav closed 5 years ago
What's doing the function getItem()
?
sorry I forgot to remove that getItem() while copying the code:
geoFirestore.getLocation("documentId", new GeoFirestore.LocationCallback()
{
@Override
public void onComplete(GeoPoint geoPoint, Exception e)
{
e.printStackTrace();
}
});
this is the actual code
The function returns a NullPointerException
because the queried geolocation is null; this can depend on two factors:
GeoPoint
or a List<Double>
sorry I forgot to remove that getItem() while copying the code:
geoFirestore.getLocation("documentId", new GeoFirestore.LocationCallback() { @Override public void onComplete(GeoPoint geoPoint, Exception e) { e.printStackTrace(); } });
this is the actual code
The function returns a
NullPointerException
because the queried geolocation is null; this can depend on two factors:
- In the database, your data is not set correctly with "l" and "g" fields
- The "l" field of your data is not correctly set, it needs to be a
GeoPoint
or aList<Double>
I am facing same issue and I've checked my firestore database there is entry of l and g https://www.screencast.com/t/7FGNG0eYzJ6 I've write this code, Let me know if I made any mystake
geoFirestore.getLocation(documentId, object : GeoFirestore.LocationCallback {
override fun onComplete(geoPoint: GeoPoint?, exception: Exception?) {
if(exception == null &&geoPoint!=null ){
}
else{
}
}
})
W/System.err: java.lang.NullPointerException: Location doesn't exist W/System.err: at org.imperiumlabs.geofirestore.GeoFirestore$getLocation$2.onSuccess(GeoFirestore.kt:195) W/System.err: at org.imperiumlabs.geofirestore.GeoFirestore$getLocation$2.onSuccess(GeoFirestore.kt:16) W/System.err: at com.google.android.gms.tasks.zzn.run(Unknown Source:4) W/System.err: at android.os.Handler.handleCallback(Handler.java:873) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err: at android.os.Looper.loop(Looper.java:201) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6806) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
sorry I forgot to remove that getItem() while copying the code:
geoFirestore.getLocation("documentId", new GeoFirestore.LocationCallback() { @Override public void onComplete(GeoPoint geoPoint, Exception e) { e.printStackTrace(); } });
this is the actual code how you solved this issue, Can you please guide me so I can check my issue
When I run the following code,
I get this exception:
My
setLocation()
works fine and location is getting entered in database fine.