I\'m writing an Android application which is targeted to API level 15 but I also want to keep backward-compatibilty with older API levels (min-sdk 7).
I\'m going to
You have to ask yourself a few questions:
In your case, getWidth()
is deprecated in favor of using getSize(Point), which requires API level 13. So prior to API level 13, all you have is getWidth()
, which at the time was not deprecated. The reason these deprecated methods are kept around is largely with backwards compatibility in mind (along with avoiding breaking everyone's apps which depend on it).
So to answer your questions, yes, this is fine in this case, and yes, it's a good use of @SuppressWarning("deprecation")
.