문제

여기에 내 코드가 있습니다.내가 이것을 실행할 때 나는 오류를 얻는다 :

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++)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top