Good day, I have a small code that manages to copy a text that is inside a webView which loads a web page. The problem is that I do not get that when extracting the text from the clipboard this does not respect the line breaks.
final ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.addPrimaryClipChangedListener(new ClipboardManager.OnPrimaryClipChangedListener() {
@Override
public void onPrimaryClipChanged() {
ClipData clipData = clipboard.getPrimaryClip();
ClipData.Item item = null;
if (clipData != null) {
item = clipData.getItemAt(0);
if (!mPreviousText[0].equals(item.getText().toString())){
mPreviousText[0] = item.getText().toString();
myEditText.setText(mPreviousText[0]);
}
}
}
});
assuming that the text you are copying is as follows:
"A word from the translator to his friends
I offer
naked, virgins, intact and simple. "
what it returns to me would be:
"A word from the translator to his friends I offer naked, virgins, intact and simple."
And I do not know what is due, thank you in advance.