'Allow users to select text in a webview android

I have a webview in my app that I would like to allow users to highlight text in yellow there.

I need to allow users to select, undo the select text and keep the selected text for next time user open the app. Any ideas how can I archive this in java?

I saw some other posts here, but they are old and using some basic javascript that not keep the results and do not allow user to undo the selected texts.

Thanks a lot.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source