Program: 63500
Project: 63500
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mMapView=findViewById(R.id.mapView);
  queryButton=findViewById(R.id.queryButton);
  queryInputBox=findViewById(R.id.queryInputBox);
  ArcGISMap map=new ArcGISMap(Basemap.createStreetsVector());
  Point initialLocation=new Point(-13171939.239529,3923971.284048,SpatialReferences.getWebMercator());
  Viewpoint viewpoint=new Viewpoint(initialLocation,9500000);
  map.setInitialViewpoint(viewpoint);
  mMapView.setMap(map);
  ArcGISMapImageLayer imageLayer=new ArcGISMapImageLayer(getString(R.string.usa_map));
  map.getOperationalLayers().add(imageLayer);
  GraphicsOverlay graphicsOverlay=new GraphicsOverlay();
  mMapView.getGraphicsOverlays().add(graphicsOverlay);
  SimpleMarkerSymbol citySymbol=new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE,0xFFFF0000,16);
  SimpleLineSymbol stateSymbol=new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID,0xFF0000FF,6);
  SimpleLineSymbol countyLineSymbol=new SimpleLineSymbol(SimpleLineSymbol.Style.DASH,0xFF00FFFF,2);
  SimpleFillSymbol countySymbol=new SimpleFillSymbol(SimpleFillSymbol.Style.DIAGONAL_CROSS,0xFF00FFFF,countyLineSymbol);
  queryInputBox.setText(Integer.toString(1800000));
  queryButton.setEnabled(false);
  imageLayer.addDoneLoadingListener(() -> {
    if (imageLayer.getLoadStatus() == LoadStatus.LOADED) {
      queryButton.setEnabled(true);
      ArcGISMapImageSublayer citiesSublayer=(ArcGISMapImageSublayer)imageLayer.getSublayers().get(0);
      ArcGISMapImageSublayer statesSublayer=(ArcGISMapImageSublayer)imageLayer.getSublayers().get(2);
      ArcGISMapImageSublayer countiesSublayer=(ArcGISMapImageSublayer)imageLayer.getSublayers().get(3);
      citiesSublayer.loadAsync();
      statesSublayer.loadAsync();
      countiesSublayer.loadAsync();
      queryButton.setOnClickListener(v -> {
        graphicsOverlay.getGraphics().clear();
        QueryParameters populationQuery=new QueryParameters();
        populationQuery.setWhereClause("String_Node_Str" + queryInputBox.getText().toString());
        populationQuery.setGeometry(mMapView.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY).getTargetGeometry());
        QueryAndDisplayGraphics(citiesSublayer,citySymbol,populationQuery,graphicsOverlay);
        QueryAndDisplayGraphics(statesSublayer,stateSymbol,populationQuery,graphicsOverlay);
        QueryAndDisplayGraphics(countiesSublayer,countySymbol,populationQuery,graphicsOverlay);
      }
);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mMapView=findViewById(R.id.mapView);
  mQueryButton=findViewById(R.id.queryButton);
  mQueryInputBox=findViewById(R.id.queryInputBox);
  ArcGISMap map=new ArcGISMap(Basemap.createStreetsVector());
  Point initialLocation=new Point(-13171939.239529,3923971.284048,SpatialReferences.getWebMercator());
  Viewpoint viewpoint=new Viewpoint(initialLocation,9500000);
  map.setInitialViewpoint(viewpoint);
  mMapView.setMap(map);
  ArcGISMapImageLayer imageLayer=new ArcGISMapImageLayer(getString(R.string.usa_map));
  map.getOperationalLayers().add(imageLayer);
  GraphicsOverlay graphicsOverlay=new GraphicsOverlay();
  mMapView.getGraphicsOverlays().add(graphicsOverlay);
  SimpleMarkerSymbol citySymbol=new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE,0xFFFF0000,16);
  SimpleLineSymbol stateSymbol=new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID,0xFF0000FF,6);
  SimpleLineSymbol countyLineSymbol=new SimpleLineSymbol(SimpleLineSymbol.Style.DASH,0xFF00FFFF,2);
  SimpleFillSymbol countySymbol=new SimpleFillSymbol(SimpleFillSymbol.Style.DIAGONAL_CROSS,0xFF00FFFF,countyLineSymbol);
  mQueryInputBox.setText(Integer.toString(1800000));
  mQueryButton.setEnabled(false);
  imageLayer.addDoneLoadingListener(() -> {
    if (imageLayer.getLoadStatus() == LoadStatus.LOADED) {
      mQueryButton.setEnabled(true);
      ArcGISMapImageSublayer citiesSublayer=(ArcGISMapImageSublayer)imageLayer.getSublayers().get(0);
      ArcGISMapImageSublayer statesSublayer=(ArcGISMapImageSublayer)imageLayer.getSublayers().get(2);
      ArcGISMapImageSublayer countiesSublayer=(ArcGISMapImageSublayer)imageLayer.getSublayers().get(3);
      citiesSublayer.loadAsync();
      statesSublayer.loadAsync();
      countiesSublayer.loadAsync();
      mQueryButton.setOnClickListener(v -> {
        graphicsOverlay.getGraphics().clear();
        QueryParameters populationQuery=new QueryParameters();
        populationQuery.setWhereClause("String_Node_Str" + mQueryInputBox.getText().toString());
        populationQuery.setGeometry(mMapView.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY).getTargetGeometry());
        QueryAndDisplayGraphics(citiesSublayer,citySymbol,populationQuery,graphicsOverlay);
        QueryAndDisplayGraphics(statesSublayer,stateSymbol,populationQuery,graphicsOverlay);
        QueryAndDisplayGraphics(countiesSublayer,countySymbol,populationQuery,graphicsOverlay);
      }
);
    }
  }
);
}