Android ParseQueryAdapter notifyDataSetChanged not working

Using the latest Parse v1.5.1 library

Thanks to the update, I can now do:

ParseQueryAdapter<ParseObject> mAdapter = new ParseQueryAdapter<ParseObject>(MainActivity.this, new ParseQueryAdapter.QueryFactory<ParseObject>() {
    @Override
    public ParseQuery<ParseObject> create() {

        ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(ParseObject.class);
        query.fromLocalDatastore();

        return query;
    }
});
mListView.setAdapter(mAdapter);

Now I have some pinned objects and they are displayed correctly, but when I unlock them like this:

//Some ParseObject in the above adapter
object.unpinInBackground(new DeleteCallback() {
    @Override
    public void done(ParseException e) {
        if(e == null) {
            //I beleive this would be the correct approach.
            mAdapter.notifyDataSetChanged();
        }
    }
});

Naturally, I want this element to disappear from the corresponding one ListView, but this is not so. But I will say that I return to another action and review this activity, it ListViewdisplays correctly without a recently closed object.

This is mistake? If not what am I doing wrong?

+4
source share
2 answers

) ParseQueryAdapter.loadObjects().

+2

mAdapter.remove(object) notifyDataSetChanged();

unpinInBackground . , .

, ParseQueryAdapter remove.

:

ParseQueryAdapter , ParseQuery, API .

https://www.parse.com/questions/delete-a-object-using-parsequeryadapter

0

Source: https://habr.com/ru/post/1543348/


All Articles