Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = (MapView) findViewById(R.id.mapView); mCutButton = findViewById(R.id.cutButton); ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); mMapView.setMap(map); final GraphicsOverlay graphicsOverlay = new GraphicsOverlay(); mMapView.getGraphicsOverlays().add(graphicsOverlay); final Graphic polygonGraphic = new Graphic(createLakeSuperiorPolygon(), new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0x220000FF, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF0000FF, 2))); graphicsOverlay.getGraphics().add(polygonGraphic); final Graphic polylineGraphic = new Graphic(createBorder(), new SimpleLineSymbol(SimpleLineSymbol.Style.DOT, 0xFFFF0000, 3)); graphicsOverlay.getGraphics().add(polylineGraphic); mMapView.setViewpointGeometryAsync(polygonGraphic.getGeometry()); <START> mCutButton.setOnClickListener(new View.OnClickListener() { <END> @Override public void onClick(View v) { List<Geometry> parts = GeometryEngine .cut(polygonGraphic.getGeometry(), (Polyline) polylineGraphic.getGeometry()); Graphic canadaSide = new Graphic(parts.get(0), new SimpleFillSymbol(SimpleFillSymbol.Style.BACKWARD_DIAGONAL, 0xFF00FF00, new SimpleLineSymbol(SimpleLineSymbol.Style.NULL, 0xFFFFFFFF, 0))); Graphic usSide = new Graphic(parts.get(1), new SimpleFillSymbol(SimpleFillSymbol.Style.FORWARD_DIAGONAL, 0xFFFFFF00, new SimpleLineSymbol(SimpleLineSymbol.Style.NULL, 0xFFFFFFFF, 0))); graphicsOverlay.getGraphics().addAll(Arrays.asList(canadaSide, usSide)); mCutButton.setEnabled(false); } }); }</code><technical_language>Replace lambda</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); Button cutButton = findViewById(R.id.cutButton); ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); mMapView.setMap(map); final GraphicsOverlay graphicsOverlay = new GraphicsOverlay(); mMapView.getGraphicsOverlays().add(graphicsOverlay); final Graphic polygonGraphic = new Graphic(createLakeSuperiorPolygon(), new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID,0x220000FF, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF0000FF, 2))); graphicsOverlay.getGraphics().add(polygonGraphic); final Graphic polylineGraphic = new Graphic(createBorder(), new SimpleLineSymbol(SimpleLineSymbol.Style.DOT, 0xFFFF0000, 3)); graphicsOverlay.getGraphics().add(polylineGraphic); mMapView.setViewpointGeometryAsync(polygonGraphic.getGeometry()); cutButton.setOnClickListener(v -> { List<Geometry> parts = GeometryEngine .cut(polygonGraphic.getGeometry(), (Polyline) polylineGraphic.getGeometry()); Graphic canadaSide = new Graphic(parts.get(0), new SimpleFillSymbol(SimpleFillSymbol.Style.BACKWARD_DIAGONAL, 0xFF00FF00, new SimpleLineSymbol(SimpleLineSymbol.Style.NULL, 0xFFFFFFFF, 0))); Graphic usSide = new Graphic(parts.get(1), new SimpleFillSymbol(SimpleFillSymbol.Style.FORWARD_DIAGONAL, 0xFFFFFF00, new SimpleLineSymbol(SimpleLineSymbol.Style.NULL, 0xFFFFFFFF, 0))); graphicsOverlay.getGraphics().addAll(Arrays.asList(canadaSide, usSide)); cutButton.setEnabled(false); }); }