Reputation:
In my app android:minSdkVersion="8", I get the following warning. Now my code is OK in API 17, could you tell me if my app can always work well in future Android version? Thanks!
the constructor simplecursoradapter(context, int, cursor, string[], int[]) is deprecated
Upvotes: 0
Views: 313
Reputation: 82938
It depends on those guy, when they can remove it depends on them. Deprecated meaning? is here.
By reviewing the SimpleCursorAdapter doc, you will get two methods.. The one you are using SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) and another is SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) which added in API 11 after deprecation of previous.
The docs says
This constructor was deprecated in API level 11. This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use LoaderManager with a CursorLoader.
So You should modify your method as
if(android.os.Build.VERSION.SDK_INT >= 11) {
//Call another constructor
} else {
//the constructor which you are calling
}
Upvotes: 2
Reputation: 19098
Deprecated functions are superseded with others that fulfil the same purpose in a better or more efficient way.
The answer to your question:
could you tell me if my app can always work well in future Android version?
Is almost certainly no - deprecated functions get phased out after a certain amount of time.
My advice is to use the replacement function as soon as you can implement it. There will be more benefits than just futureproofing.
Upvotes: 0
Reputation: 6459
Usually, when a feature is deprecated, they provide a new way to do the same thing. You should move to that new way of doing things.
Upvotes: 1