我正在尝试将我的位置存储到parse.com数据库中,但是这样做有问题。首先,我无法将任何东西存储到数据库中,因为我相信它会返回null或类似的东西。不太清楚这是什么行为。有人可以指引我正确的方向吗?
double longitude = location.getLongitude();
double latitude = location.getLatitude();
// Get longitude of the current location
// Create a LatLng object for the current location
LatLng latLng = new LatLng(latitude, longitude);
ParseObject parkingobject = new ParseObject("Cooking");
parkingobject.put("username","Alana");
ParseGeoPoint point = new ParseGeoPoint(latLng); //<----- This is where the error is.
parkingobject.put("Location", point);
最佳答案
double longitude = location.getLongitude();
double latitude = location.getLatitude();
ParseGeoPoint geoPoint = new ParseGeoPoint(latitude , longitude );
ParseObject parkingobject = new ParseObject("Cooking");
parkingobject.put("username","Alana");
parkingobject.put("Location", geoPoint );
试试这个代码。