ListAdapters and WrapperListAdapter algorithm
Posted
by Matty F
on Stack Overflow
See other posts from Stack Overflow
or by Matty F
Published on 2010-05-21T13:48:51Z
Indexed on
2010/05/21
13:50 UTC
Read the original article
Hit count: 309
This logic is written in a function with signature
private void showDialog(final AdapterView<? extends Adapter> parent,
String title, String message, final Tag subject)
Is there a better way of doing this?
// refresh adapter
SimpleCursorAdapter adapter;
if (parent.getAdapter() instanceof WrapperListAdapter) {
adapter = (SimpleCursorAdapter) ((WrapperListAdapter) parent.getAdapter()).getWrappedAdapter();
} else {
adapter = (SimpleCursorAdapter) parent.getAdapter();
}
adapter.getCursor().requery();
adapter.notifyDataSetChanged();
Also, is there any point in having AdapterView<? extends Adapter>
in the signature and not just AdapterView<?>
?
© Stack Overflow or respective owner