12-21 22:38:59.498: E/AndroidRuntime(3011): FATAL EXCEPTION: main 12-21 22:38:59.498: E/AndroidRuntime(3011): java.lang.IllegalStateException: Graphics layer is not bounded to a map! 12-21 22:38:59.498: E/AndroidRuntime(3011): at com.esri.android.map.GraphicsLayer.nativeGetGraphicsAt(Native Method) 12-21 22:38:59.498: E/AndroidRuntime(3011): at com.esri.android.map.GraphicsLayer.getGraphicIDs(Unknown Source) 12-21 22:38:59.498: E/AndroidRuntime(3011): at com.esri.android.map.GraphicsLayer.getGraphicIDs(Unknown Source) 12-21 22:38:59.498: E/AndroidRuntime(3011): at com.esri.arcgis.android.samples.attributeeditor.AttributeEditorActivity$2.onSingleTap(AttributeEditorActivity.java:148) 12-21 22:38:59.498: E/AndroidRuntime(3011): at com.esri.android.map.MapOnTouchListener.onSingleTap(Unknown Source) 12-21 22:38:59.498: E/AndroidRuntime(3011): at com.esri.android.map.MapGestureDetector$a.onSingleTapConfirmed(Unknown Source) 12-21 22:38:59.498: E/AndroidRuntime(3011): at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:281) 12-21 22:38:59.498: E/AndroidRuntime(3011): at android.os.Handler.dispatchMessage(Handler.java:99) 12-21 22:38:59.498: E/AndroidRuntime(3011): at android.os.Looper.loop(Looper.java:137) 12-21 22:38:59.498: E/AndroidRuntime(3011): at android.app.ActivityThread.main(ActivityThread.java:4514) 12-21 22:38:59.498: E/AndroidRuntime(3011): at java.lang.reflect.Method.invokeNative(Native Method) 12-21 22:38:59.498: E/AndroidRuntime(3011): at java.lang.reflect.Method.invoke(Method.java:511) 12-21 22:38:59.498: E/AndroidRuntime(3011): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 12-21 22:38:59.498: E/AndroidRuntime(3011): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 12-21 22:38:59.498: E/AndroidRuntime(3011): at dalvik.system.NativeStart.main(Native Method)
public void onSingleTap(float x, float y) { // convert event into screen click pointClicked = mapView.toMapPoint(x, y); // build a query to select the clicked feature Query query = new Query(); query.setOutFields(new String[] { "*" }); query.setSpatialRelationship(SpatialRelationship.INTERSECTS); query.setGeometry(pointClicked); query.setInSpatialReference(mapView.getSpatialReference()); // call the select features method and implement the callbacklistener featureLayer.getGraphicIDs(x, y, 15); featureLayer.selectFeatures(query, ArcGISFeatureLayer.SELECTION_METHOD.NEW, new CallbackListener<FeatureSet>() { // handle any errors public void onError(Throwable e) { Log.d(TAG, "Select Features Error" + e.getLocalizedMessage()); } public void onCallback(FeatureSet queryResults) { if (queryResults.getGraphics().length > 0) { Log.d(TAG, "Feature found id=" + queryResults.getGraphics()[0].getAttributeValue(featureLayer.getObjectIdField())); // set new data and notify adapter that data has changed listAdapter.setFeatureSet(queryResults); listAdapter.notifyDataSetChanged(); // This callback is not run in the main UI thread. All GUI // related events must run in the UI thread, // therefore use the Activity.runOnUiThread() method. See // http://developer.android.com/reference/android/app/Activity.html#runOnUiThread(java.lang.Runnable) // for more information. AttributeEditorActivity.this.runOnUiThread(new Runnable() { public void run() { // show the editor dialog. showDialog(ATTRIBUTE_EDITOR_DIALOG_ID); } }); } } }); }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.