i have a android app which uses the SimpleCursorAdapter
i have the min API level 9
when i want to use the SimpleCursorAdapter i use the following constructor:
SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to)
but then i get the message that this is deprecated.
so i change it to the newer version:
SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags)
but then my min API level should be 11 but i dont want to change it.
is it possible to let android check the version like: if api level >= 11 use the new one, else use the old?
Try the SimpleCursorAdapter from the support class. It is used like the API 11+ version and it is already backwards compatible.
Odds are you already downloaded the Support Library (if you haven’t you really should), so you only need to change the import: