Edit:
Based on the comments (thanks) I posted my solution as a separate answer: https://stackoverflow.com/a/36485266/1052697
Original question:
This Android answer has some major flaws in it, because it can cause an IndexOutOfBoundsException
when pasting text with multiple new-line characters.
"Copy pasting from Stack Overflow danger ahead"
Because the answer has quite some up-votes (and apparently many people use the code provided as it is) I decided to edit it (edited version).
The edits I made are in my opinion quite significant, the complete code logic has been changed. Now I'm wondering if I did the right thing. The answer also originally stated the following:
This solution was created in collaboration with Mobile Identity: http://www.mobile-identity.com/
Which isn't the best online advertisement for Mobile Identity...
Anyway, I also decided to remove the statement. As it does not contribute to the answer nor is it needed. I Also removed it because non of the original code-logic stayed the same (so any credit to Mobile Identity seems to be out of place).
Did I do the right thing? Should I have posted a completely new answer?
This solution was created in collaboration with Mobile Identity: http://www.mobile-identity.com/
- this is back in since the last rollback - is this.. ok? I wouldn't have thought this was ok. Edit: I'll try removing it and see if it's accepted.