ListAdapters and WrapperListAdapter algorithm
- by Matty F
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<?>?