2

I have a (HTML) span in a WebView which contains text that is sometimes unselectable. This is for an open-source Japanese Kanji learning app, so the text is in Japanese, perhaps that is why long-press selection sometimes doesn't work properly. I don't know. Anyway, what I am trying to do is this:

When the user long-presses any part of the whole span box (where the actual text is centred), I want to pretend like the user actually long-pressed the text, so I want to 'android select' the text, which would bring up the copy-paste context dialog too.

I found a way to 'html select' the text via javascript, but this does not trigger an 'android select', i.e. the copy-paste context dialog does not show.

I have searched extensively for a way of selecting text in a WebView through Java (1, 2, 3, especially 4). That last one seemed promising but most of the question and answers seem nonsensical. I think this is because I am working with Android 7.0, while the answers seem to use a 'Selection Mode' which the latest Android doesn't have.

Aralox
  • 1,441
  • 1
  • 24
  • 44

0 Answers0