Dynamic "where" in custom ParseQueryAdapter

I am using Parse.com as a framework to populate a ListView. My adapter looks like this:

    public ItemsQueryAdapter(Context context) {
    super(context, new ParseQueryAdapter.QueryFactory<ParseObject>() {
        public ParseQuery create() {
            ParseQuery Query = ParseQuery.getQuery("Item");
            LatLngBounds latLngBounds = new LatLngBounds.Builder().
                    include(SphericalUtil.computeOffset(currentLatLng, currentRadius, 0)).
                    include(SphericalUtil.computeOffset(currentLatLng, currentRadius, 90)).
                    include(SphericalUtil.computeOffset(currentLatLng, currentRadius, 180)).
                    include(SphericalUtil.computeOffset(currentLatLng, currentRadius, 270)).build();
            itemsQuery.whereWithinGeoBox("location", new ParseGeoPoint(latLngBounds.southwest.latitude, latLngBounds.southwest.longitude), new ParseGeoPoint(latLngBounds.northeast.latitude, latLngBounds.northeast.longitude));
            itemsQuery.orderByDescending("createdAt");
            itemsQuery.include("user");
            return itemsQuery;
        }
    });
}

      

And my ListView is populated like this:

    itemsQueryAdapter = new ItemsQueryAdapter(getActivity());
    ListView listView = (ListView) getView().findViewById(R.id.lvItems);
    listView.setAdapter(itemsQueryAdapter);
    itemsQueryAdapter.loadObjects();

      

The problem I am facing is that inside a custom adapter, both currentLatLng and currentRadius can change and therefore must be dynamically "loaded" on each loadObjects (). Is there a way to do this?

Best regards, D.

+3
android dynamic parse.com


source to share


No one has answered this question yet

Check out similar questions:

872
Deserialize JSON to dynamic C # object?
837
How to hide title bar for Activity in XML with existing custom theme
614
Where can I find Android source code online?
277
Dynamically add items to listView android
1
Get EditText control from ListView in Xamarin Studio using C #
0
ListView OnLongClick strange behavior
0
Dynamically add button to view from ListView Adapter GetView method
0
Android ListView changes after onItemClick
0
How to use array of objects with Android ArrayAdapter?
0
Parse.com and Android: how to remove a row at Parse.com from a ListView



All Articles
Loading...
X
Show
Funny
Dev
Pics