AnsweredAssumed Answered

Offline Query Error

Question asked by ssiddiqui on Mar 24, 2015

Hello,

 

I am trying to make query with Local geodatabase,

Using ArcGIS Android API 10.2.5

 

When i am trying to get the records it through the exception as i am new in android development for java,

 

Can any one please review my code and solve the problem. I have attached the attachment for exception and code below.

 

      mMapView.setOnSingleTapListener(new OnSingleTapListener() {

            @Override

            public void onSingleTap(final float x, float y) {

                 QueryParameters q = new QueryParameters();

                // optional

                q.setWhere("1=1");

                q.setOutSpatialReference(mMapView.getSpatialReference());

                q.setReturnGeometry(true);

                q.setOutFields(new String[]{"*"});

                q.setInSpatialReference(mMapView.getSpatialReference());

      {

             Future<FeatureResult> resultFuture=   geodatabaseFeatureTable.queryFeatures(q, new CallbackListener<FeatureResult>() {

                    @Override

                    public void onError(Throwable ex) {

                        // Highlight errors to the user.

                        showToast("Error querying FeatureServiceTable");

                    }

 

                    @Override

                    public void onCallback(FeatureResult objs) {

 

                       // If there are no query results, inform user.

                        if (objs.featureCount() < 1) {

                            showToast("No results");

                            return;

                        }

                        else {

                            // Report number of results to user.

                            showToast("Found features.");

                            for (Object objFeature : objs) {

                                showToast("Feature found inside for loop");

                            }

                        }

                    }

                });

                try {

                  for (Object element : resultFuture.get()) {

                        if (element instanceof Feature)

                        {

                            // element is of type Feature for queries without out-statistics

                            Feature f = (Feature) element;

                            showToast("Feature found inside for loop2");

                        }

                  }

                } catch (InterruptedException e) {

                    e.printStackTrace();

                } catch (ExecutionException e) {

                    e.printStackTrace();

                }

            }

        });

    }

Attachments

Outcomes