At first: I know that onDrag and onLongClick available only on API 11(android 3.0) or higher.
Class implements onDragListener and onLonglickListener. It’s work only at API 11 and higher.
when I want set setonLongclickListener on view I use code like this:
.....
protected static final int sdk = android.os.Build.VERSION.SDK_INT;
......
......
if(sdk >= 11){
for (int i = 0; i < LlayoutFront.getChildCount(); i++){
LlayoutFront.getChildAt(i).setOnDragListener(this);
}
LlayoutDeleteArea.setOnDragListener(this);
LlayoutSetupArea.setOnDragListener(this);
findViewById(R.id.RelativeLMain).setOnDragListener(this);
}
but app crashed when i try to run it on android 2.1.
@SuppressLint("NewApi") before my Class isn’t save my situation.
Any ideas?
I solve it 😉
remove implements method
onDragListenerandonLongClickListenerfrom me Class.and modify code like this: