Is it possible to add @Override keyword with conditional define (I mean on some API version only)

Viewed 61

I want to override the actionmode. However the base class have now starting at API 23+ the public method onWindowFocusChanged. in my code I override like this

@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {

}

but i want also to target api < 23, and in api < 23 if i call MyObject.onWindowFocusChanged i will receive a E/AndroidRuntime(23165): java.lang.NoSuchMethodError: android.view.ActionMode.onWindowFocusChanged

is it possible to say the keyword @Override only if api >= 23 and else to omit it ?

1 Answers
Related