title: Fatal exception : AsyncTask #1 Android
body: <p>I am trying to use AsyncTask (Learning) ,,Getting Fatal Exception error
  This is the call</p>
  
  <pre><code>        String username = usr_number.getText().toString();
          String password = password_main.getText().toString();
          String[] Loginvalues = {username,password};
  
          new CheckUsername().execute(Loginvalues);
  </code></pre>
  
  <p>And this is the Class </p>
  
  <pre><code>public class CheckUsername extends AsyncTask&lt;String[], Integer, String[]&gt;{
  
      @Override
      protected String[] doInBackground(String[]... params) {
          // TODO Auto-generated method stub
          String username = params[0].toString();
          String password = params[1].toString();
          System.out.println(username);
          System.out.println(password);
          return null;
      }
  
  }
  </code></pre>
  
  <p>This is the Error i am getting </p>
  
  <pre><code>05-09 03:11:04.428: E/AndroidRuntime(1139): FATAL EXCEPTION: AsyncTask #1
  05-09 03:11:04.428: E/AndroidRuntime(1139): Process: com.hexwhale.pocketcollege, PID: 1139
  05-09 03:11:04.428: E/AndroidRuntime(1139): java.lang.RuntimeException: An error occured while executing doInBackground()
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at android.os.AsyncTask$3.done(AsyncTask.java:300)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at java.lang.Thread.run(Thread.java:841)
  05-09 03:11:04.428: E/AndroidRuntime(1139): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at com.hexwhale.pocketcollege.CheckUsername.doInBackground(CheckUsername.java:11)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at com.hexwhale.pocketcollege.CheckUsername.doInBackground(CheckUsername.java:1)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at android.os.AsyncTask$2.call(AsyncTask.java:288)
  05-09 03:11:04.428: E/AndroidRuntime(1139):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  </code></pre>