Is there a way to detect long presses on links and images inside a WebView?
I looked inside the Browser.apk source code and found what I was really looking for:
public void onCreate(Bundle savedInstanceState) {
// ...
registerForContextMenu(descriptionWebView);
// ...
}
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
WebView.HitTestResult hitTestResult = descriptionWebView.getHitTestResult();
switch (hitTestResult.getType()) {
// ...
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With