I am apparently having an issue with 1 activity on a Samsung Nexus in an app and I can\'t understand what is actually causing the the issue.
java.lang.ArrayI
Had to same Problem after Updating Android Studio (or the sdk..). I could fix it by setting the inputType of the EditText.
android:inputType="text"
My experience may help to those pals, who don't want to add custom TextView to their projects.
First, I could reproduce this error in the Android emulator (4.1.2 , API 16). After this I decided to figure out what is causing this error. Obviously - some formatting (which causes "spans" to be created). It turned out that in my case it was enough to replace in two places e.g. this:
\"<b>@username</b>\"
with this:
\"@username\"
I Had The same problem. Its not only an issue on jellyBean. It has to do with a text view adding span tags to html converted plain text causing an indexOutOfBounds exception. There is a workaround at this link.
Replace your text view with this custom textView. If the span tag issue arrises, this catches it and instead displays the content in plain text.
public class PatchedTextView extends TextView {
public PatchedTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public PatchedTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public PatchedTextView(Context context) {
super(context);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
try{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}catch (ArrayIndexOutOfBoundsException e){
setText(getText().toString());
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
@Override
public void setGravity(int gravity){
try{
super.setGravity(gravity);
}catch (ArrayIndexOutOfBoundsException e){
setText(getText().toString());
super.setGravity(gravity);
}
}
@Override
public void setText(CharSequence text, BufferType type) {
try{
super.setText(text, type);
}catch (ArrayIndexOutOfBoundsException e){
setText(text.toString());
}
}
}
Seems to be a known bug with TextView. Check similar issues here and here
There is mention of the galaxy in the post. The first issue is marked for future release, the second seemed to have been fixed.
UPDATED
djmedic has found a workaround here