in my little app I want to display something from my String.xml I normaly use this to do this:
public void putText() {
    String[] text1 = getResources().getStringArray(R.array.text1);
    String[] text2 = getResources().getStringArray(R.array.text2);
    if(selecter >= MAX) {
        selecter = 0;
    }
    else {
        selecter++;
    }
    // Texte anzeigen und Shown table auf true setzen.
    // normally selecter instead of 6
    txt_text1.setText(text1[6]);
    txt_text2.setText(text2[6]);
}
but when 'selecter' is between 6 and 9(nine is the MAX variable) the app crashes with this error:
FATAL EXCEPTION: main
                                                   Process: com.example.alex.wouldyoupressthebutton, PID: 22844
                                                   java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.alex.wouldyoupressthebutton/com.example.alex.wouldyoupressthebutton.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=6; index=6
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2750)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2811)
                                                       at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:154)
                                                       at android.app.ActivityThread.main(ActivityThread.java:6316)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
                                                    Caused by: java.lang.ArrayIndexOutOfBoundsException: length=6; index=6
                                                       at com.example.alex.wouldyoupressthebutton.MainActivity.putText(MainActivity.java:175)
                                                       at com.example.alex.wouldyoupressthebutton.MainActivity.onCreate(MainActivity.java:85)
                                                       at android.app.Activity.performCreate(Activity.java:6757)
                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2703)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2811) 
                                                       at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) 
                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                       at android.os.Looper.loop(Looper.java:154) 
                                                       at android.app.ActivityThread.main(ActivityThread.java:6316) 
                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) 
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) 
Here is also my string.xml
<string-array name="text1">
    <item>You would have everything you want</item>
    <item>You can go back in time when you want</item>
    <item>You gain the ability to communicate with animals</item>
    <item>You gain any one super-power of your choice (aside from immortality)</item>
    <item>You would become the greatest player in your favorite sport</item>
    <item>You gain omniscience (infinite knowledge of everything)</item>
    <item>You become the most talented musician in the world (any instrument)</item>
    <item>Instead of Dying, you regenerate</item>
    <item>You wil have unlimited money</item>
    <item>Everyone on earth love and adore you</item>
</string-array>
<string-array name="text2">
    <item>you don\'t understand the human language anymore.</item>
    <item>you can only talk to one person per each travel.</item>
    <item>you lose the ability to communicate with humans</item>
    <item>you lose your ability to swim</item>
    <item>you would constantly be criticized</item>
    <item>you have it for 24 hours, and afterwards you gain permanent down syndrome.</item>
    <item>you cannot earn any money from your talent.</item>
    <item>you only can regenerate 12 times, and each time you look like a different person but retain all memories.</item>
    <item>you can never sleep again.</item>
    <item>never fall in love yourself.</item>
</string-array>
I have tried a shorter text in the String.xml but I still got the message... And this only happets between six and the MAX(9)
any suggestions why?
 
     
    