If an element was deprecated in API level 11, is it considered a deprecated element (not to be used if it can be helped) in API levels below 11 also or just 11 and above? If I am writing an app for API level 8, should I care about an element that was deprecated in API level 11?
This is slightly confusing to me. In Android API, for the SQLiteDatabase class for example, the method setLockingEnabled(boolean lockingEnabled) says: This method was deprecated in API level 16. This method now does nothing. Do not use.
Does that mean it does nothing for all API levels below also or just API level 16 and above?
And if you are working on professional, commercial software, how important is it to avoid deprecated elements?
If an element was deprecated in API level 11, is it considered a deprecated element (not to be used if it can be helped) in API levels below 11 also or just 11 and above?
Just 11 and above.
If I am writing an app for API level 8, should I care about an element that was deprecated in API level 11?
"Deprecated" in Android usually means "we think that there is a better solution that you should consider, but we will support this old approach as best we can as long as we can". While you should endeavor to stop using deprecated methods, that's not something you should panic about and drop everything to address right away, and often times you need the deprecated materials for older Android OS levels, before they were deprecated.
Does that mean it does nothing for all API levels below also or just API level 16 and above?
Since they said "now does nothing", it is safe to say that it did something (non-nothing?) previously.
And if you are working on professional, commercial software, how important is it to avoid deprecated elements?
In the specific case of this method, I'd skip using it, though that's more due to the nature of this method.
As a counter-example, the way preference screens are set up differs substantially in API Level 11+ (PreferenceFragment
and PreferenceActivity
) versus before (PreferenceActivity
alone). You can't avoid the deprecated element on older devices, simply because there is no viable alternative (e.g., backport of PreferenceFragment
).
From the Docs
Annotation type used to mark program elements that should no longer be used by programmers. Compilers produce a warning if a deprecated program element is used.
I would suggest trying not to use them at all when possible. When you do I would take into consideration that this object, method, etc...may not work at some point in the future. When you build an app you typically want to build it so it can be easily maintained and flexible in the future. For this reason, I wouldn't use them if not necessary and there is almost always another way to do something
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With