Sometimes users require getting the coded values of the field in Android Runtime. It is a little complicated to get to the Coded domain from the geodatabase.
Following is an example code to get it. This is for offline geodatabase(Runtime Content), same can be done for geodatabase coming from Service using ServiceFeatureTable class.
String path = "/storage/emulated/0/testdomainclass.geodatabase";
geodatabase = null;
geodatabase = new Geodatabase(path);
geodatabase.loadAsync();
geodatabaseFeatureTable = geodatabase.getGeodatabaseFeatureTable("points");
geodatabaseFeatureTable.loadAsync();
Field field = geodatabaseFeatureTable.getField("name");
Domain domain = field.getDomain();
CodedValueDomain codedValueDomain = ((CodedValueDomain) domain);
List<CodedValue> codedvaluelist = codedValueDomain.getCodedValues();
In the above example, codedvaluelist object will contain the name and the code which can be retrieved using following code:
codedvaluelist.get(0).getName();
codedvaluelist.get(0).getCode();