Android ArrayIndexOutOfBoundSecception.
-
14-11-2019 - |
문제
여기에 내 코드가 있습니다.내가 이것을 실행할 때 나는 오류를 얻는다 :
java.lang.ArrayIndexOutOfBoundsException : index= 6 길이= 6
.for(i=1;i<6;i++) { String s = getSharedPreferences("TEXT", 0).getString("DATA" + sequenceNumber, null); if(s!=null){ String[] numb= new String[6]; numb[i]=s; Bundle b=new Bundle(); b.putStringArray(key, numb); Intent i=new Intent(); i.putExtras(b); i.setClass(MainActivity.this, NotifyEmergencyCall.class); startActivity(i); } }
아무도 이것으로 도와 드릴 수 있습니까? 고맙습니다.
해결책
replace for(i=1;i<6;i++)
with for(i=0;i<5;i++)
제휴하지 않습니다 StackOverflow