-1
    ares = null;
    adob = null;
    ares = tres.split("-");
    if (!ares[0].toString().equals("0")) {
        for (int i = 0; i <= ares.length - 1; i++) {
            adob = ares[i].toString().split(",");
            // txtv = new TextView(Albums.this);
            valueTV = new TextView(Albums.this);
            valueTV.setText(adob[0].toString() + "[" + adob[1].toString()
                    + "]"); // Here I am Getting Exception !
            // valueTV.setId(i);
            valueTV.setGravity(Gravity.CENTER);
            valueTV.setLayoutParams(new LayoutParams(
                    LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
            valueTV.setTextSize(20);
            valueTV.setTextColor(Color.BLUE);
            valueTV.setClickable(true);

エラー LogCat は

08-26 14:35:00.945: W/dalvikvm(21180): threadid=1: thread exiting with uncaught exception (group=0x409e61f8)
08-26 14:35:00.975: D/dalvikvm(21180): GC_CONCURRENT freed 218K, 4% free 6798K/7047K, paused 2ms+3ms
08-26 14:35:00.975: E/AndroidRuntime(21180): FATAL EXCEPTION: main
08-26 14:35:00.975: E/AndroidRuntime(21180): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.pixitch/com.app.pixitch.Albums}: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.os.Looper.loop(Looper.java:137)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.app.ActivityThread.main(ActivityThread.java:4424)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at java.lang.reflect.Method.invokeNative(Native Method)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at java.lang.reflect.Method.invoke(Method.java:511)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at dalvik.system.NativeStart.main(Native Method)
08-26 14:35:00.975: E/AndroidRuntime(21180): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
08-26 14:35:00.975: E/AndroidRuntime(21180):    at com.app.pixitch.Albums.onCreate(Albums.java:79)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.app.Activity.performCreate(Activity.java:4492)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
08-26 14:35:00.975: E/AndroidRuntime(21180):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
08-26 14:35:00.975: E/AndroidRuntime(21180):    ... 11 more

プログラムを段階的にデバッグすると、うまく機能します。デバッグせずにプログラムを実行すると、次のようなエラーが発生します

アクティビティ ComponentInfo{com.app.pixitch/com.app.pixitch.Albums} を開始できません: java.lang.ArrayIndexOutOfBoundsException: length=1; インデックス=1

PS。

79 行目:valueTV.setText(adob[0].toString() + "[" + adob[1].toString() + "]");

4

2 に答える 2