79128751

Date: 2024-10-26 14:38:57
Score: 0.5
Natty:
Report link

@TargetApi = Thank you Lint, I will take care of it when calling it.
But, in reality if I forget to do the API level check on the calling side, Lint does not bothers. (Lint satisfied) enter image description here

@RequiresApi = Thank you Lint, I will add an API level check on the CALLING side, and If I don't, show a red line beneath. (better, but still superficial runtime safety, as we still need to put the API level check!) enter image description here

Note: In general, it's best to avoid using these annotations on lifecycle methods like onCreate (as we don't, but the framework calls them, and it can lead to unexpected crashes) Instead, use runtime checks to manage API-level-specific code.

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Long answer (-0.5):
  • No code block (0.5):
  • User mentioned (1): @TargetApi
  • User mentioned (0): @RequiresApi
  • High reputation (-1):
Posted by: Himanshu Likhyani