I'm using ArcGIS Android SDK for first time. I have worked on a sample project and am able to get a World map using this..

map = (MapView) findViewById(R.id.map);
map.addLayer(new ArcGISDynamicMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"));

But my problem is:
I have some *.shp (shapefile) files and I would like to show them on mapview.

How can i do that?

  • to run without RuntimeException we should have three type of files in a single directory 1 .dbf 2 .shp 3.shx
    – user86298
    Nov 14, 2016 at 12:20

2 Answers 2


You cannot add data from a shapefile directly to the MapView. You can only add various types of Layers to the Map View. See this Page for more details: Map layer types

You could however create a Map Tile Package from a mapservice and use it instead if you desire offline access, by using it in a Local Tile Layer

  1. Download the shapefile to the device.
  2. Make sure that your app has permission to read files from your storage:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> (having permission to write implicitly grants you this permission)

Then, do something like:

    try {
        ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable(shapeFilePath);
    } catch (FileNotFoundException ex) {
        Toast.makeText(this, R.string.shapefile_not_found, Toast.LENGTH_LONG).show();

and to add it to the map:

    FeatureLayer featureLayer = new FeatureLayer(shapefileFeatureTable);
    featureLayer.setRenderer(new SimpleRenderer(new SimpleFillSymbol(

This should show the feature with a thin black border.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.