mapviewhelper addPolygonGraphic !?

1165
2
07-29-2016 05:03 AM
Highlighted
New Contributor III

How to create polygon using mapviewhelper addPolygonGraphic !?

Reply
0 Kudos
2 Replies
Highlighted
Regular Contributor II

I believe this is a duplicate of How do i create polygon using mapviewhelper ?

Reply
0 Kudos
Highlighted
Regular Contributor II

Hello Mohamed EzzerI​,

I was able to get the feature to draw in Casablanca using the following snippet:

package com.arcgis.androidsupportcases.addpolygongraphic;

import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import com.esri.android.map.MapView;
import com.esri.android.map.event.OnStatusChangedListener;
import com.esri.android.toolkit.map.MapViewHelper;

public class MainActivity extends AppCompatActivity {

  MapView mapView;

  @Override protected void onCreate(Bundle savedInstanceState) {

   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);

   mapView = (MapView) findViewById(R.id.map);
   mapView.setOnStatusChangedListener(new OnStatusChangedListener() {

   @Override public void onStatusChanged(Object o, STATUS status) {

   if (status == STATUS.INITIALIZED) {

  MapViewHelper mapViewHelper = new MapViewHelper(mapView);
  double[][] latLon = new double[][] {{

   33.599389, -7.610728
   },
   {

   33.599985, -7.597180
   },
   {

   33.588879, -7.617027
   }

  };
  int graphic = mapViewHelper.addPolygonGraphic(latLon,"pol_t", "pol_st", "", Color.GREEN, Color.DKGRAY,2, 0);
   Log.e("NOHE", "" + graphic);
   }

  }

  });

  }

}

Here is the screenshot of my end result:

2016-08-01_10-46-35.png

Reply
0 Kudos