Reputation: 1889
The method is ImageButton's setImageAlpha(), and it says in the documentation that it was "Added in API 16."
But it doesn't give me an error when I try to use it, unlike some other methods that get underlined red and tell me it's not supported by the API I'm supporting?
Upvotes: 0
Views: 88
Reputation: 7128
One of the largest reasons Android will not error out these methods is that some methods introduce a cleaner/faster way to accomplish a task, which is great to include for users with a higher API level. A simple API level if check
can allow users with a higher API level to user the cleaner/faster approach while not crashing the app for a device with a lower API level.
Erroring out the method would prevent you from supporting newer methods for users with a higher API, while still supporting devices with a lower API.
Upvotes: 1