android lint still give "Call requires API ..." error after I put check there

StackOverflow https://stackoverflow.com/questions/19815665

  •  04-07-2022
  •  | 
  •  

Вопрос

I have the following code:

if(android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1){
     enter_pos.callOnClick();
}

But I still get error from Lint:

Call requires API level 15 (current min is 12): android.widget.Button#callOnClick

Why Lint is still giving error even after I put a check for the API version? I am using

Android Developer Tools
Build: v22.0.5-757759

Under Windows 8. Thanks in advance for any suggestions!

Это было полезно?

Решение

You should put @SuppressLint("NewApi") above the method you are using this. Lint cannot decide if you do your check right by looking at your code

Другие советы

In your eclipse Window -> preferences -> Android -> Lint error checking uncheck the two check boxes and apply changes and then clean the project.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top