title: ArrayException in my TestActivity.java class
body: <p>I get ArrayException when i tried run my TestActivity.java class,</p>
  
  <p>This is First Time i use Arrays ,</p>
  
  <p>maybe i did something incorrect</p>
  
  <p>PLEASE HELP AND ANSWER</p>
  
  <p>This is TestActivity.java class :</p>
  
  <pre><code>package com.MalekAlrwily.multiplication;
  
  import java.util.Random;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class TestActivity extends Activity { 
  
  static String[] numbers = {"1","2","3","4","5","6","7","8","9","10"};
  static String TrueAnswer ;
  static int mark = 0 ;
  
  @Override
  protected void onCreate(Bundle savedInstanceState){
  
      super.onCreate(savedInstanceState);
      setContentView(R.layout.test);
  
      Button center = (Button) findViewById(R.id.center);
      Button right = (Button) findViewById(R.id.right);
      Button left = (Button) findViewById(R.id.left);
      TextView question = (TextView) findViewById(R.id.question) ;
  
      int number = TestActivity.getNumber();
  
      question.setText(TestActivity.ArabicNumbers(number) + " × " + TestActivity.ArabicNumbers(MainActivity.num));
  
      Random r = new Random();
      int i = r.nextInt(4-1) + 1;
  
      if (i==1){
  
          TestActivity.TrueAnswer = "center";
          center.setText(TestActivity.ArabicNumbers(number));
          Random r2 = new Random();
          int i2 = r2.nextInt(100-0) + 0;
          Random r3 = new Random();
          int i3 = r3.nextInt(100-0) + 0;
  
          right.setText(TestActivity.ArabicNumbers(i2));
          left.setText(TestActivity.ArabicNumbers(i3));
  
      }else if (i==2){
  
          TestActivity.TrueAnswer = "right";
          right.setText(TestActivity.ArabicNumbers(number));
          Random r2 = new Random();
          int i2 = r2.nextInt(100-0) + 0;
          Random r3 = new Random();
          int i3 = r3.nextInt(100-0) + 0;
  
          center.setText(TestActivity.ArabicNumbers(i2));
          left.setText(TestActivity.ArabicNumbers(i3));
  
      }else{
  
          TestActivity.TrueAnswer = "left";
          left.setText(TestActivity.ArabicNumbers(number));
          Random r2 = new Random();
          int i2 = r2.nextInt(100-0) + 0;
          Random r3 = new Random();
          int i3 = r3.nextInt(100-0) + 0;
  
          right.setText(TestActivity.ArabicNumbers(i2));
          center.setText(TestActivity.ArabicNumbers(i3));
  
      }
  
      center.setOnClickListener(l);
      right.setOnClickListener(l);
      left.setOnClickListener(l);
  
  }
  
  OnClickListener l = new OnClickListener(){
  
      @Override
      public void onClick(View arg0) {
  
          if (arg0.getTag().toString() == TestActivity.TrueAnswer){
              TestActivity.mark++ ;
          }
  
          int count = 0 ;
  
          for( int i = 0 ; i &lt; TestActivity.numbers.length ; i++ ){
  
              if ( TestActivity.numbers[i] != "" ){
                  count = 1 ;
              }
  
          }
  
          if (count==0){
              Intent i = new Intent(TestActivity.this,MarkActivity.class) ;
              startActivity(i) ;
              MarkActivity.mark = TestActivity.ArabicNumbers(TestActivity.mark) ;
          }else{
  
              Button center = (Button) findViewById(R.id.center);
              Button right = (Button) findViewById(R.id.right);
              Button left = (Button) findViewById(R.id.left);
              TextView question = (TextView) findViewById(R.id.question) ;
  
              int number = TestActivity.getNumber();
  
              question.setText(TestActivity.ArabicNumbers(number) + " × " + TestActivity.ArabicNumbers(MainActivity.num));
  
              Random r = new Random();
              int i = r.nextInt(4-1) + 1;
  
              if (i==1){
  
                  TestActivity.TrueAnswer = "center";
                  center.setText(TestActivity.ArabicNumbers(number));
                  Random r2 = new Random();
                  int i2 = r2.nextInt(100-0) + 0;
                  Random r3 = new Random();
                  int i3 = r3.nextInt(100-0) + 0;
  
                  right.setText(TestActivity.ArabicNumbers(i2));
                  left.setText(TestActivity.ArabicNumbers(i3));
  
              }else if (i==2){
  
                  TestActivity.TrueAnswer = "right";
                  right.setText(TestActivity.ArabicNumbers(number));
                  Random r2 = new Random();
                  int i2 = r2.nextInt(100-0) + 0;
                  Random r3 = new Random();
                  int i3 = r3.nextInt(100-0) + 0;
  
                  center.setText(TestActivity.ArabicNumbers(i2));
                  left.setText(TestActivity.ArabicNumbers(i3));
  
              }else{
  
                  TestActivity.TrueAnswer = "left";
                  left.setText(TestActivity.ArabicNumbers(number));
                  Random r2 = new Random();
                  int i2 = r2.nextInt(100-0) + 0;
                  Random r3 = new Random();
                  int i3 = r3.nextInt(100-0) + 0;
  
                  right.setText(TestActivity.ArabicNumbers(i2));
                  center.setText(TestActivity.ArabicNumbers(i3));
  
              }
          }
  
      }
  };
  
  public static String ArabicNumbers(int EnglishNumbers){
  
      char[] ArabicNumbers = {'٠','١','٢','٣','٤','٥','٦','٧','٨','٩'};
      String Result = "" ;
  
      for( int i = 0 ; i &lt; String.valueOf(EnglishNumbers).length() ; i++ ){
  
          Result += ArabicNumbers[Integer.parseInt(String.valueOf(EnglishNumbers).substring(i , i + 1))];
  
      }
  
      return Result ;
  
  }
  
  public static int getNumber(){
      int[] numbers = {} ;
  
      for( int i = 0 ; i &lt; TestActivity.numbers.length ; i++ ){
          if(TestActivity.numbers[i] != ""){
              numbers[numbers.length] = Integer.parseInt(TestActivity.numbers[i]);
          }
      }
  
      Random r = new Random();
      int i = r.nextInt(numbers.length-0) + 0;
  
      for( int u = 0 ; u &lt; TestActivity.numbers.length  ; u++  ){
  
          if ( TestActivity.numbers[u].equals(numbers[i])){
              TestActivity.numbers[u] = "" ;
          }
  
      }
  
      return numbers[i] ;
  }
  }
  </code></pre>
  
  <p>and LogCat :</p>
  
  <pre><code>12-20 05:18:55.369: W/dalvikvm(1301): threadid=1: thread exiting with uncaught exception (group=0x41465700)
  12-20 05:18:55.489: E/AndroidRuntime(1301): FATAL EXCEPTION: main
  12-20 05:18:55.489: E/AndroidRuntime(1301): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MalekAlrwily.multiplication/com.MalekAlrwily.multiplication.TestActivity}: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.os.Handler.dispatchMessage(Handler.java:99)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.os.Looper.loop(Looper.java:137)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.app.ActivityThread.main(ActivityThread.java:5103)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at java.lang.reflect.Method.invokeNative(Native Method)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at java.lang.reflect.Method.invoke(Method.java:525)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at dalvik.system.NativeStart.main(Native Method)
  12-20 05:18:55.489: E/AndroidRuntime(1301): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at com.MalekAlrwily.multiplication.TestActivity.getNumber(TestActivity.java:180)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at com.MalekAlrwily.multiplication.TestActivity.onCreate(TestActivity.java:30)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.app.Activity.performCreate(Activity.java:5133)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
  12-20 05:18:55.489: E/AndroidRuntime(1301):     ... 11 more
  </code></pre>
  
  <p>Please don't hold my question ,</p>
  
  <p>Thanks in Advance.</p>