Selecting text in a WebView and capture the spans - android

My question pretty much speaks for itself. I want to be able to not only capture the text when selecting text in a WebView, but I also want to capture the spans surrounding the text. Is there any way to do this natively?

Related

Webview (Android) detect which word of text is touched

I have a Webview with a lots of texts (Sentences).
Is there a way to findout which word of that text is selected when I touch the webview?
I know we can mark and copy words from the webview, but if there are lots of the same word, how can I find out which I have selected?

Reading text from anywhere on mobile screen with accessibility service in android without click event

I am trying to read text from anywhere on mobile screen with accessibility service. Well, I've tried many tutorials and solutions but what I want is a bit different. I have a floating button on screen like chathead, I want to read the text from the specific area bellow the floating button. An application UDictionary is already doing it and i have attached a short clip of it. I'm successfully getting text by clicking on the text but the Question is:
How to get text by dragging the floating button over text and without click ?
Video clip:
Any help would be appreciated.

Android :prevent EditText from rendering Emoji

What I need is to stop edittext from Rendering system default Emojis
and use my own emojis with the same rendering way ( unicodes ) , so I DONT to FILTER the Text so it wont pass the text between a range so that emojis wont show up and I just don't know which method to override or remove from default EditText to stop this rendering . the casue I need to do this is that whenever I want to render my own emojis it will first be rendered to system default emojis and quickly changes the span to mine and this isn't nice
if I use filters then I wont be able to enter any emojis with Unicode so filtering by emoji Unicode range is not the ANSWER !
in EditText xlm set attribute
app:emojiCompatEnabled="false"
it will stop render emoji by AppCompat

accessibility of truncated view in Android

what should be the Talkback behavior on the truncated view. In one application talkback is reading entire message along with the view more button. Functionality is like that when using click on more detail additional detail what expanded and more details button become the less details, problem is that when focus went to truncated messages talkback is reading entire message which could be of one paragraph to too many paragraphs or so on. Ideally it should read only display message however functionality has been designed in such a way that entire text is coming in application and through UI it has been hide.
My questions are
1 is there a way to read only that part of text which has been displayed even whole message has been provided
2 if not possible above approach, who'd be the length of characters talkback should read and stop as i can do so
I also keep this thing in mind that length in truncated view can be increase or decrease depending on screen xiae
Thanks
Anubhav
Set the view's content description to be the truncated version of the text. Update the content description when the truncated text changes, ex. if the view size changes.
someView.setContentDescription(truncatedText);

Select Text In Android

Is it Possible to Display some text say a story, in an ANDROID app which also enables the user to select some text and perform some operations on that text..
the main idea is to display some text and when the user selects some text(a word or a sentence) i need to get that text for some further operation on that text.
we cant use text view as you cant select text in textview,and we cant use editview because the user should not be able to edit the contents of the text.
Why not display the text in a WebView and enable text selection?
It works pretty well in CodePad, which is open source so you can have a look at the code here.
My first try would be to display this text in a normal TextView. Then I would provide two or three buttons to implement the selection of a part of the text. For example 1 Button to start and end selection and 2 Buttons with arrows for increasing/decreasing the part of the selection.
To highlight the part of the text which is selected, I would for example color this part of the text in a different color.
Coloring of text can be either done by using Spannable or the HTML class.

Categories

Resources