Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); mBufferInput = findViewById(R.id.buffer_input); ArcGISMap map = new ArcGISMap(SpatialReferences.getWebMercator()); map.setBasemap(Basemap.createTopographic()); mMapView.setMap(map); final Geometry startingEnvelope = new Envelope(-10863035.97, 3838021.34, -10744801.344, 3887145.299, SpatialReferences.getWebMercator()); mMapView.setViewpointGeometryAsync(startingEnvelope); final GraphicsOverlay graphicsOverlay = new GraphicsOverlay(); mMapView.getGraphicsOverlays().add(graphicsOverlay); final LinearUnit miles = new LinearUnit(LinearUnitId.MILES); final LinearUnit meters = new LinearUnit(LinearUnitId.METERS); final SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0x8800FF00, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF057e15, 5)); mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this,mMapView){ @Override public boolean onSingleTapConfirmed(MotionEvent motionEvent){ android.graphics.Point clickLocation = new android.graphics.Point(Math.round(motionEvent.getX()), Math.round(motionEvent.getY())); Point mapPoint = mMapView.screenToLocation(clickLocation); <START> if(mBufferInput.getText().toString().length() !=0){ <END> Polygon bufferGeometry = GeometryEngine .buffer(mapPoint,miles.convertTo(meters,Double.valueOf(mBufferInput.getText().toString()))); Graphic bufferGraphic = new Graphic(bufferGeometry,fillSymbol); graphicsOverlay.getGraphics().add(bufferGraphic); Graphic markerGraphic = new Graphic(mapPoint, new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF0000, 5)); graphicsOverlay.getGraphics().add(markerGraphic); } return true; } }); }</code><technical_language>replace '!mBufferInput.getText().toString().isEmpty()' for clarity</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); mBufferInput = findViewById(R.id.buffer_input); ArcGISMap map = new ArcGISMap(SpatialReferences.getWebMercator()); map.setBasemap(Basemap.createTopographic()); mMapView.setMap(map); final Geometry startingEnvelope = new Envelope(-10863035.97, 3838021.34, -10744801.344, 3887145.299, SpatialReferences.getWebMercator()); mMapView.setViewpointGeometryAsync(startingEnvelope); final GraphicsOverlay graphicsOverlay = new GraphicsOverlay(); mMapView.getGraphicsOverlays().add(graphicsOverlay); final LinearUnit miles = new LinearUnit(LinearUnitId.MILES); final LinearUnit meters = new LinearUnit(LinearUnitId.METERS); final SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0x8800FF00, new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF057e15, 5)); mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this,mMapView){ @Override public boolean onSingleTapConfirmed(MotionEvent motionEvent){ android.graphics.Point clickLocation = new android.graphics.Point(Math.round(motionEvent.getX()), Math.round(motionEvent.getY())); Point mapPoint = mMapView.screenToLocation(clickLocation); if(!mBufferInput.getText().toString().isEmpty()){ Polygon bufferGeometry = GeometryEngine .buffer(mapPoint,miles.convertTo(meters,Double.valueOf(mBufferInput.getText().toString()))); Graphic bufferGraphic = new Graphic(bufferGeometry,fillSymbol); graphicsOverlay.getGraphics().add(bufferGraphic); Graphic markerGraphic = new Graphic(mapPoint, new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF0000, 5)); graphicsOverlay.getGraphics().add(markerGraphic); } else { Toast.makeText(MainActivity.this, "Please enter a buffer distance first.", Toast.LENGTH_LONG).show(); } return true; } }); }