I have a database as follows:
------------------------------
BOOK NAME | BOOK FORMAT | COUNT |
------------------------------
Android | HTML | 1
WPF | PDF | 10
Symbian | PS | 2
Windows | HTML | 2
I show this database to the user using CustomSimpleCursorAdapter.
CustomSimpleCursorAdapter extends SimpleCursorAdapter
implements filterable
when getView()u runQueryonBackgroundThread()will be redefined.
The view of the grid table has been removed.
The user has the following options:
HTML | Pdf | PS | REMOVE
Constraint: BOOK FORMAT
[HTML - 1, PDF - 2, PS - 3]
When the user clicks the HTML button, books with the HTML type should be displayed.
inside the MenuOption () handler, I wrote the following:
adapter.getFilter().filter("1");
runQueryonBackgroundThread() {
if(mCursor != null)
mCursor.close();
mCursor = query(using the constraint)
return mCursor;
}
This limit reaches my excess runQueryonBackgroundThread()
method. But it does not update the grid view and throws an exception.
"FILTER: android.view.ViewRoot $ CalledFromWrongThreadException: only the original thread that created the view hierarchy can touch its views"
Please help me.