Select to view content in your preferred language

Sample to use MapViewHelper class

915
2
11-05-2013 11:37 PM
ThomasBinu
Deactivated User
Hi guys,
      I have been trying to use the MapViewHelper class to show a callout on a graphic when the user taps on it. But so far, I haven't been able to get it to work. Can anypone post a sample for MapViewHelperClass

Thanks,
Tom
0 Kudos
2 Replies
LiLin1
by Esri Contributor
Esri Contributor
Hi Thomas,

The following is code snippet.


MapView map = new MapView(this);
.....
mapHelper = new MapViewHelper(map);
mapHelper.setShowGraphicCallout(true);  // this can be omitted. by default it is on.
......
Point p = ...; // lat and lon
int order = ...;
mapHelper.addMarkerGraphic(p.getY(), p.getX(), "marker",
         "This is a sample.", R.drawable.flower,
                        map.getContext().getResources().getDrawable(R.drawable.tree), true, order);
0 Kudos
DanO_Neill
Deactivated User
The MapViewHelper class requires the application framework jar added to your project.  Once added you can start using the API. You can create an instance of a MapViewHelper class by passing a MapView to it's constructor

MapViewHelper mvHelper = new MapViewHelper(map);


To view the javadoc for the API inside of Eclipse, hover over the MapViewHelper class you just created and press F2 for focus.  While in focus select the Open Attached Javadoc in Browser.  The API Javadoc will open in the Eclipse browser perspective.  Li's code above shows how to interact with a Callout from the MapViewHelper class.  We are working on a sample and accompanying article about the new simplified programmer workflows using the Application Framework for Android.  In the mean time, let us know if you need anything more specific for your use case.
0 Kudos