Onlongclicklistener Does Not Work On Webview
I have the following struktur to implement an longclicklistener. It works if I click on a text on the webview which contains a html-link, so I know the structure is not completely
Solution 1:
I tried now to clone the longclick action by myself. This works but only a few times. After a certain time, the onTouch-Event is not called anymore... Suggestions?
private Runnable copyTextAfterDelay=new Runnable() {
publicvoidrun() {
...
}
};
...
myWebView.setOnTouchListener(newView.OnTouchListener() {
@OverridepublicbooleanonTouch(View v, MotionEvent event) {
switch (event.getAction()) {
caseMotionEvent.ACTION_DOWN:
mTimerHandler.removeCallbacks(copyTextAfterDelay);
mTimerHandler.postDelayed(copyTextAfterDelay,1000);
break;
caseMotionEvent.ACTION_UP:
mTimerHandler.removeCallbacks(copyTextAfterDelay);
break;
caseMotionEvent.ACTION_MOVE:
mTimerHandler.removeCallbacks(copyTextAfterDelay);
break;
}
returnfalse;
}
});
Post a Comment for "Onlongclicklistener Does Not Work On Webview"