Reputation: 825
Are there any disadvantages to using deprecated methods in my code?
For example, I am using view.setBackgroundDrawable(background)
in api 19 and it's working fine, but I want to know the proper way.
Upvotes: 1
Views: 612
Reputation: 172220
The main disadvantage is that the API might not be available in future versions, which will increase the cost of updating your application. It's also an indication that the SDK developers believe that there is a "better way" to do what you want to do.
Thus, in the end, it's a cost/value tradeoff: If the deprecated method is easy to replace, use the replacement. If it isn't, it's up to you to decide whether developing the "future-proof" way is worth the additional effort.
For example:
setBackgroundDrawable
can easily be replaced by setDrawable
(see the comment in the documentation of setBackgroundDrawable
).startManagingCursor
is much harder to replace, so one might put off transitioning to ContentProvider
until there is no other option.Upvotes: 9