I've created a feature layer from a feature collection. The feature collection is created from a cursor from a query on a sqlite table. The feature layer is not appearing on the map. The following method is called by the onCreate() method. To determine the layer definition, I appended "/?f=json" to the layer's rest url and then replaced all " with \". Also, I can add an ArcGISFeatureLayer from a map service in the onCreate method. public void updateEventsLayers(){
String layerDefinition = "{\"geometryType\":\"esriGeometryPoint\",\"drawingInfo\":{\"renderer\":{\"type\":\"uniqueValue\",\"field1\":\"Species\",\"field2\" : null,\"field3\" : null,\"fieldDelimiter\":\", \",\"defaultSymbol\" : null,\"defaultLabel\":\"\u003call other values\u003e\",\"uniqueValueInfos\":[{\"value\":\"Dolphin\",\"label\":\"Dolphin\",\"description\":\"\",\"symbol\":{\"type\":\"esriPMS\",\"url\":\"7A88B187\",\"imageData\":\"iVBORw0KGgoAAAANSUhEUgAAABgAAAAZCAYAAAArK+5dAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA51JREFUSIntlX1ME2ccx79311KE8WLLS4ulpKzYUiwKTKrgwpxgps5JtjjURINKdBonyRZfZ2Ai1UiMRrYZMb6RdQScRM0YNWM9jcVW0WrVscJASWFQp4FsvGgpvev+WOishaIu+2v7/nX53fc+n+ee5J7j4F8O5z8h4C7KWLpeJU/JnBzCD6cokhxyDA00t1u6zjRU3gGgBeB6JcHOfM17gojokoVzcpX66zpuVlo2IvlCz/2ij/abDmn3vqWtr6gYHh42vZRgf+HRHcr4aTtmqjJD2jqt2LRvJb7/wugliJgcPVvz8eH09KSMoPWlywQA6l5IcLL4bG5YiKB4piqTBwAX9DUAgMK9q7Fh+RY4XU4QIBArkiAtcRa15O28pUOOQXxyoOA+AKtfgdvtJo7uqqrISMniAUDPoy4c+Ho3AKDd3opPDxZ49eNEMny5/TRWLFiz5OqtS7219Dcb/Arqyo1bk2QzolzMCHSG8yg7XjTWS3pis7djceEcXDzSFLA6d6PCaKWT7Xb73XEFvb8/WpWqTEdV/SlsObTOBygTybG1oARpSjWiBCI8dTyBrvECyk4U43hJjToU0Qvt8CMI5AXFUhQHBys1PvDt+aVY+8EmhASHeWbc1wKQrV6AwrJ8XLVcmZSd9Y64tdoy/hZxKE4wy7Kw99l8BCp5ihd8NIbbNKr26RDJjwI/ODzYi/d8mXWzTPfjTvLNGTnYtuZzKOKnYRIvCL/YrNB+dwzx4gRIpyT83WcZpCaqIRFJAQANJp3XR+cjcDEjvQMDfwhP7PkWoc+sNjFehdLN5XAxI159kqQ8cLebxa/2jod+BWJhHA1gRegYW0EQBLicAJ/5aNpsLd0Xb5yr9SuQS5S76gy1eQkSBfUXlPSsbvR6xOUEl+ICBOH1rOGm/lZfX5/l2ZmPIHoe0WGsbD3daKbX8niB4IdFQCZR4HJTA+RSJWKiYmEw6/G6eCrEwjhU6yoxVz0fXQ9tnXrj+c+e5415VMyOmbquvr93+oOe+28IBTEwN5uQrEjFk6eDaDTTkIplcDJOGMw03s16H/pr9YMtHVYNbaHvvZCAyCHY5mb3LPIyqb3XdvvDzJS5ZHgoH4KwSMQKpZ5eTKQYV5p+bGvtaNlWXq05NxZr3NM0KYlgACy/U9O958ZPpsNusMmB3EA+SVEk42L6Bx39tt8e9/yw86vNRQAc43Em/OFMz5vyM4CciXqvLPin+V8wYf4EvZtBGCRM1vgAAAAASUVORK5CYII=\",\"contentType\":\"image/png\",\"color\" : null,\"width\":18,\"height\":18.75,\"angle\":0,\"xoffset\":0,\"yoffset\":0}},{\"value\":\"Whale\",\"label\":\"Whale\",\"description\":\"\",\"symbol\":{\"type\":\"esriPMS\",\"url\":\"71DC084\",\"imageData\":\"iVBORw0KGgoAAAANSUhEUgAAABgAAAAZCAYAAAArK+5dAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA2JJREFUSIntlWtIU2EYx//nHHXT2dC5Ni+lxqYzl2spZc5udBHDsiCysguRFVFESJEakl2QqChIIqi0NDO6Q1HZhbQPJUklU9NcJTJBp2s7a5vzuPSc9SGS1Dat6FP9vz4Pv9/D88LzeuEvx+ufEHhr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\"xoffset\":0,\"yoffset\":0}}]},\"transparency\":0,\"labelingInfo\" : null},\"displayField\":\"Species\",\"fields\":[{\"name\":\"OBJECTID\",\"type\":\"esriFieldTypeOID\",\"alias\":\"OBJECTID\"},{\"name\":\"eventType\",\"type\":\"esriFieldTypeSmallInteger\",\"alias\":\"eventType\"},{\"name\":\"DATE\",\"type\":\"esriFieldTypeDate\",\"alias\":\"DATE\",\"length\":36},{\"name\":\"eventID\",\"type\":\"esriFieldTypeDouble\",\"alias\":\"eventID\"},{\"name\":\"Species\",\"type\":\"esriFieldTypeString\",\"alias\":\"Species\",\"length\":50},{\"name\":\"Type\",\"type\":\"esriFieldTypeString\",\"alias\":\"Type\",\"length\":50},{\"name\":\"count_\",\"type\":\"esriFieldTypeSmallInteger\",\"alias\":\"count_\"},{\"name\":\"behavior\",\"type\":\"esriFieldTypeString\",\"alias\":\"behavior\",\"length\":50},{\"name\":\"distance\",\"type\":\"esriFieldTypeString\",\"alias\":\"distance\",\"length\":50},{\"name\":\"Shape\",\"type\":\"esriFieldTypeGeometry\",\"alias\":\"Shape\"}],\"typeIdField\":\"eventType\",\"types\":[{\"id\":0,\"name\":\"Begin Survey\",\"domains\":{}},{\"id\":1,\"name\":\"Position Update\",\"domains\":{}},{\"id\":2,\"name\":\"Observation\",\"domains\":{}},{\"id\":3,\"name\":\"End Survey\",\"domains\":{}}],\"relationships\":[],\"capabilities\":\"Map,Query,Data\"}";
ArrayList<Item> items = new ArrayList<Item>();
ArrayList<Graphic> grList = new ArrayList<Graphic>();
SpatialReference webMercator = SpatialReference.create(102100);
mCursor = mDbManager.fetchAll();
int count = mCursor.getCount();
String colCount = "" + mCursor.getColumnCount();
int i = 0;
mCursor.moveToFirst();
while (mCursor.isAfterLast() == false){
Item item = new Item();
item.setID(mCursor.getInt(0));
item.setEventType(mCursor.getInt(2));
item.setLatitude(mCursor.getDouble(3));
item.setLongitude(mCursor.getDouble(4));
item.setSpecies(mCursor.getString(5));
item.setType(mCursor.getString(6));
items.add(item);
i= i + 1;
mCursor.moveToNext();
}
for (Item item : items) {
Point pointwm = GeometryEngine.project(item.getLongitude(),
item.getLatitude(), webMercator);
Graphic gr = new Graphic(pointwm, null, null, null);
grList.add(gr);
}
Graphic[] grs = new Graphic[grList.size()];
grs = grList.toArray(grs);
FeatureSet fs = new FeatureSet();
fs.setGraphics(grs);
Options options = new Options();
options.mode = MODE.SNAPSHOT;
ArcGISFeatureLayer fLayer = new ArcGISFeatureLayer(layerDefinition, fs,
options);
map.addLayer(fLayer);
}