Offline Query Error

2855
0
03-24-2015 04:46 AM
shabbirsiddiqui2
New Contributor III

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();

                }

            }

        });

    }

0 Kudos
0 Replies