Offline viewing of shapefiles for android?

12-04-2014 05:42 PM
New Contributor

Hi there

Does the SDK let me display locally stored shape files on the user's android device?

-We'd like to show the shape file of the local area and indicate to  the user where they currently are.

- We'd also like t be able to add extra shape file layers for information of interest. e.g location of various types of assets.

If the SDK lets me do that can someone point me in the direction of the "how to"

cheers and thanks


(using eclipse)

0 Kudos
6 Replies
New Contributor II
0 Kudos
New Contributor

Okay thanks, i was already aware of this , how about a method that doesn't involve adding 3rd party libraries?

i.e. is there an "esri library only" path?



0 Kudos
Regular Contributor II

Yes, the API supports the direct reading of shapefiles as of 10.2.4.

The code looks like this...

// Create shapefile feature table from path to .shp file

shapefileTable = new ShapefileFeatureTable("path/to/Shapefile.shp");

featureLayer = new FeatureLayer(shapefileTable); 

// create a renderer

UniqueValueRenderer uvRenderer = new UniqueValueRenderer( new SimpleFillSymbol(new Color(0, 0, 0, 255), null), "CONTINENT");

// set renderer



Then, just add the featureLayer to your map, and there you go.

This is one of my favorite enhancements to the API!

New Contributor

thanks for that but i get an error on

UniqueValueRenderer uvRenderer = new UniqueValueRenderer( new SimpleFillSymbol(new Color(0, 0, 0,255), null), "CONTINENT");

to do with the incorrect number of arguments? are we working off different sdks ?


0 Kudos
New Contributor

Have you ever read the articles below?

Working with symbols and renderers—ArcGIS Runtime SDK for Android | ArcGIS for Developers

SimpleFillSymbol | ArcGIS Android 10.2.5 API

I'm developing with ArcGIS Runtime for Android 10.2.4 too, the .shp file was loaded and shown correctly.

I tested this with polygon features, so my code looks like this:

featureLayer.setRenderer(new SimpleRenderer(new SimpleFillSymbol(5, STYLE.VERTICAL)));

Maybe to check the feature type is helpful?

0 Kudos
New Contributor II

Yes you were working of diferent sdks, that was from Javascrip sdk.

Android renderer should look something like this:

      FeatureLayer mFlayer = new FeatureLayer(mTable);

      mFlayer.setRenderer(new SimpleRenderer(new SimpleMarkerSymbol(Color.RED, 10, STYLE.SQUARE)));
0 Kudos