The easiest way is to write two implementations of your custom view class, for example:
MyCustomViewBasic extends View {
private MySharedImplementation impl;
}
MyCustomViewKeyLongPress extends View {
private MySharedImplementation impl;
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
}
}
, , , API 4, .
xml-, API 4 API 4 . MyCustomViewBasic API 4 MyCustomViewKeyLongPress API 4