Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArcGISScene scene = new ArcGISScene(); scene.setBasemap(Basemap.createImagery()); mSceneView = findViewById(R.id.sceneView); mSceneView.setScene(scene); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(getString(R.string.elevation_image_service)); scene.getBaseSurface().getElevationSources().add(elevationSource); mAnalysisOverlay = new AnalysisOverlay(); mSceneView.getAnalysisOverlays().add(mAnalysisOverlay); Camera camera = new Camera(new Point(-73.10861935949697, -49.25758493899104, 3050), 106, 73, 0); mSceneView.setViewpointCamera(camera); LineOfSight.setVisibleColor(Color.CYAN); LineOfSight.setObstructedColor(Color.MAGENTA); mSceneView.setOnTouchListener(new DefaultSceneViewOnTouchListener(mSceneView) { @Override public boolean onSingleTapConfirmed(MotionEvent motionEvent) { android.graphics.Point screenPoint = new android.graphics.Point(Math.round(motionEvent.getX()), Math.round(motionEvent.getY())); Point scenePoint = mSceneView.screenToBaseSurface(screenPoint); if (mObserverLocation == null) { <START> mObserverLocation = new Point(scenePoint.getX(), scenePoint.getY(), scenePoint.getZ() + mZOffset, scenePoint.getSpatialReference()); <END> } else { mTargetLocation = new Point(scenePoint.getX(), scenePoint.getY(), scenePoint.getZ() + mZOffset, scenePoint.getSpatialReference()); LocationLineOfSight locationLineOfSight = new LocationLineOfSight(mObserverLocation, mTargetLocation); mAnalysisOverlay.getAnalyses().add(locationLineOfSight); } return super.onSingleTapConfirmed(motionEvent); } }); }</code><technical_language>get uncaught error (and similar line below) scenePoint null - e.g. if tap horizon of earth (e.g. valid location return)</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArcGISScene scene = new ArcGISScene(); scene.setBasemap(Basemap.createImagery()); mSceneView = findViewById(R.id.sceneView); mSceneView.setScene(scene); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource( getString(R.string.elevation_image_service)); scene.getBaseSurface().getElevationSources().add(elevationSource); mAnalysisOverlay = new AnalysisOverlay(); mSceneView.getAnalysisOverlays().add(mAnalysisOverlay); Camera camera = new Camera(new Point(-73.10861935949697, -49.25758493899104, 3050), 106, 73, 0); mSceneView.setViewpointCamera(camera); LineOfSight.setVisibleColor(Color.CYAN); LineOfSight.setObstructedColor(Color.MAGENTA); mSceneView.setOnTouchListener(new DefaultSceneViewOnTouchListener(mSceneView) { @Override public boolean onSingleTapConfirmed(MotionEvent motionEvent) { android.graphics.Point screenPoint = new android.graphics.Point(Math.round(motionEvent.getX()), Math.round(motionEvent.getY())); Point scenePoint = mSceneView.screenToBaseSurface(screenPoint); if (scenePoint != null) { if (mObserverLocation == null) { mObserverLocation = new Point(scenePoint.getX(), scenePoint.getY(), scenePoint.getZ() + mZOffset, scenePoint.getSpatialReference()); } else { mTargetLocation = new Point(scenePoint.getX(), scenePoint.getY(), scenePoint.getZ() + mZOffset, scenePoint.getSpatialReference()); LocationLineOfSight locationLineOfSight = new LocationLineOfSight(mObserverLocation, mTargetLocation); mAnalysisOverlay.getAnalyses().add(locationLineOfSight); } } else { Toast.makeText(MainActivity.this, "Please select a point on the surface.", Toast.LENGTH_LONG).show(); } return super.onSingleTapConfirmed(motionEvent); } }); }