mardi 15 mars 2016

Why Cursor getCount always return 0 when data inserts with using ActiveAndroid

I create cursor

 this.cursorCategories = ActiveAndroid.getDatabase().rawQuery(new Select().from(GSCategory.class).toSql(), null);
        this.cursorCategories.registerContentObserver(new ContentObserver(null) {

            @Override
            public void onChange(boolean selfChange) {
                super.onChange(selfChange);
                Log.e("ContentObserver", String.valueOf(cursorCategories.getCount()) + " SC:" + String.valueOf(selfChange));
            }

        });

        this.cursorCategories.setNotificationUri(getContext().getContentResolver(), ContentProvider.createUri(GSCategory.class, null));

In another thread i insert data to database and onChange fired, but Cursor always return zero count.

Why?

Aucun commentaire:

Enregistrer un commentaire