问题
I want to know what are the differences between CursorAdapter and SimpleCursorAdapter. Based on what criteria someone would choose the one or the other. Your experiences working with them? Thank you
回答1:
CursorAdapter is abstract and is to be extended. On the other hand, SimpleCursorAdapter is not abstract.
Notice that newView(Context context, Cursor cursor, ViewGroup parent) is abstract in CursorAdapter but implemented in SimpleCursorAdapter. This is because SimpleCursorAdapter has a specific mechanism to initiate views while CursorAdapter leaves it up to the developer.
回答2:
I think that the main question is still not answered. SimpleCursorAdapter exists for those who want to save some time making their own CursorAdapter. SimpleCursorAdapter is already made from google and you just tell him how should the layout look like and what ids of widgets you want to fill with your chunks of data, so you dont have to override methods of CursorAdapter and implement them. But you can use only TextView and ImageView in your layout, because it doesn't support more widgets so far.
So as result SimpleCursorAdapter takes like 2 lines of code but extending CursorAdapter means lots more but you have more options for customization. I believe SimpleCursorAdapter should be enough in most cases.
来源:https://stackoverflow.com/questions/8382644/simplecursoradapter-and-cursoradapter