onLongClick for plain text inside of a WebView
I am building an app that contains a WebView which will be used to show the user some links and some plain text. I want to make i开发者_如何学Ct so that the user can LongClick on a link, or a body of text and get the option to delete that thing from the html thats being shown in the WebView. This question got me half way there. LongClicking on the links works by using the wv.getHitTestResult() method. But now my problem is when I long click on plain text the onLongClick() method of the listener doesn't get called, and even if it did getHitTestResult() would not return the text that the user is touching(I tried setting an onTouchListener to see if getHitTestResult().getExtra() had a value when I touched plain text)
So my questions is does anyone know how I can get LongClick events inside of a WebView that are on text that is not Linkified?(I assume this is possible some how because that is how I can select text in the default browser). and once I get the LongClick event how can I get access to which body of text was clicked?
I have got an answer here ,
https://stackoverflow.com/a/5908125/1503130
Also if you have any other fix to the problem then do share it.
精彩评论