user4766730
user4766730

Reputation:

storing Geopoints into Parse.com

I am trying to store my location into the parse.com database, but i have having an issue doing so. First of all, I can't store anything into the database I believe it is returning null or something so. Not quite sure whats the behavior. Can someone guide me in the right direction?

       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);

Upvotes: 1

Views: 884

Answers (1)

55597
55597

Reputation: 2132

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 );

Try this code.

Upvotes: 1

Related Questions