AnsweredAssumed Answered

Getting CodedValueDomain from QueryTask result.

Question asked by salihyalcin89 on Jul 7, 2015
Latest reply on Aug 10, 2015 by WCrick-esristaff

Hello everyone,

I am developing an app that uses QueryTask feature of Esri Android SDK. Evertyhing is perfect except one thing. QueryTask results return Attribute Values and I am displaying this values at Popup. Let me explain deeply. Results have district field. I use district_name with coded value. For example; When value 1 district name display Green, when value 2 district name display Blue. At the SDK side, I am able to show district name =1 or district name=2. I want to show real district name with CodedValueDomain.


I showed like left popup my attributes but I want to show like right popup. I dont know how to access codedValueDomains. I've read API documentation, samples etc.



Here is my code approach;


private class AsyncQueryTask extends AsyncTask<String, Void, FeatureResult> {

protected void onPreExecute() {
progress = new ProgressDialog(MainActivity.this);
progress =, "",
"Please wait....query task is executing");
* First member in string array is the query URL; second member is the
* where clause.
protected FeatureResult doInBackground(String... queryArray) {
if (queryArray == null || queryArray.length <= 1)
return null;
String url = ""
QueryParameters qParameters = new QueryParameters();
String whereClause = queryArray[1];
SpatialReference sr = SpatialReference.create(102100);
QueryTask qTask = new QueryTask(url);
try {
FeatureResult results = qTask.execute(qParameters);
return results;
} catch (Exception e) {
return null;
protected void onPostExecute(FeatureResult results) {
String message = "No result comes back";
if (results != null) {
int size = (int) results.featureCount();
for (Object element : results) {
progress.incrementProgressBy(size / 100);
if (element instanceof Feature) {
Feature feature = (Feature) element;
// turn feature into graphic
Graphic graphic = new Graphic(feature.getGeometry(),
feature.getSymbol(), feature.getAttributes());
// add graphic to layer
// update message with results
message = String.valueOf(results.featureCount())
+ " results have returned from query.";
Toast toast = Toast.makeText(MainActivity.this, message,
boolQuery = false;



Dan O'Neill

Will Crick