how can i add a point on the map?

1910
3
06-24-2014 09:02 PM
Mohammad_NaserSobhan_Noorzai
New Contributor
I need to add points on the map from static gps coordinations please help me, the gps is float or double but in Point(int, int) it's int?
please help me.
0 Kudos
3 Replies
ShellyGill1
Esri Contributor
Hi,

It sounds to me like you may have imported the wrong Point class, there is a number of Point classes around in standard libraries. Check the imports at the top of your class file, you might find you have:
import android.graphics.Point;
Delete that one (assuming you're not using this Android graphics point elsewhere), and replace it with the ArcGIS Runtime SDK for Android Point class import, using a statement like this:
import com.esri.core.geometry.Point;
And then go back to your Point class declaration and you should find you now have different constructors for your Point, and the x, y parameters will be doubles. Its easy to accidentally add the wrong imports sometimes, and different IDEs have different shortcuts and commands to automate adding the imports.

Hope this helps,
0 Kudos
Mohammad_NaserSobhan_Noorzai
New Contributor
thank you so much, you are right.
but can you please bring a sample code how can i add a point on the map using (GPS Coordination).

thanks man
0 Kudos
ShellyGill1
Esri Contributor
There's a few samples you might find useful - you can try out the Nearby sample to see how the LocationDisplayManager is used to set a LocationListener to get onLocationChanged callbacks that give you GPS updates:
https://developers.arcgis.com/android/sample-code/nearby/

You might find the AddCSV2GraphicsLayer sample useful to show you how to add a series of x,y coordinates to a GraphicsLayer in a map - in this case you can see the coordinates are coming from a CSV file, so you'd need to take this and change it to work with your GPS coordinates instead:
https://developers.arcgis.com/android/sample-code/addcsv-file/

Hopefully these two should give you some pointers, depending on what you actually want to do with the GPS locations.
0 Kudos