I am trying to split a Spanish string in Java. And i got the following exception:
ArrayIndexOutOfBoundsException
The string i am trying to split is: pin pon es un muñeco
Debuger shows the following error:
java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
Splitting statement:
String[] splitVideoTitle = tvTitle.getText().toString().split("\\s+");
The line of code that caused the above index exception is in this line of code:
String firstWords = splitVideoTitle[0] + " " + splitVideoTitle[1];
Any suggestions to avoid this exception is appreciated.
Thanks