Search code examples
javaandroid-listviewandroid-studiosimplecursoradapter

Which SimpleCursorAdapter should I use?


When I enter "SimpleCursorAdapter" in Droidio, it is ambivalent about which SimpleCursorAdapter class it should add:

enter image description here

I don't know either - which one should I use as a gateway to displaying the contents of SQLite data in a ListView?


Solution

  • It depends on which platforms you are planning to support you app.

    For prior to API 11 :

    Use SimpleCursorAdapter from support-v4 package if you are writing an app to support platforms prior to Android 3.0 because some of the functions of this class are not available prior to API level 11. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation.

    API level 11 and above :

    If that is not the case and you are writing an app for API level 11 and above, you can go forward using SimpleCursorAdpater from android framework which is android.widget.SimpleCursorAdapter.