title: How to solve FATAL EXCEPTION: Thread-11
body: <p>Now i am developing one in that useing Async Task Iam facing this Errors, Any one have idea of this.. </p>
  
  <pre><code>10-03 19:04:55.662: E/AndroidRuntime(1547): FATAL EXCEPTION: Thread-11
  10-03 19:04:55.662: E/AndroidRuntime(1547): java.lang.ExceptionInInitializerError
  10-03 19:04:55.662: E/AndroidRuntime(1547):     at com.cc.accounts.ChatAccountsFragment.Gtalk_logInComplete(ChatAccountsFragment.java:579)
  10-03 19:04:55.662: E/AndroidRuntime(1547):     at com.cc.xmpp.GmailXmppClient.Login(GmailXmppClient.java:92)
  10-03 19:04:55.662: E/AndroidRuntime(1547):     at com.cc.accounts.ChatAccountsFragment$5.run(ChatAccountsFragment.java:482)
  10-03 19:04:55.662: E/AndroidRuntime(1547):     at java.lang.Thread.run(Thread.java:1096)
  10-03 19:04:55.662: E/AndroidRuntime(1547): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
  10-03 19:04:55.662: E/AndroidRuntime(1547):     at android.os.Handler.&lt;init&gt;(Handler.java:121)
  10-03 19:04:55.662: E/AndroidRuntime(1547):     at android.os.AsyncTask$InternalHandler.&lt;init&gt;(AsyncTask.java:421)
  10-03 19:04:55.662: E/AndroidRuntime(1547):     at android.os.AsyncTask$InternalHandler.&lt;init&gt;(AsyncTask.java:421)
  10-03 19:04:55.662: E/AndroidRuntime(1547):     at android.os.AsyncTask.&lt;clinit&gt;(AsyncTask.java:152)
  10-03 19:04:55.662: E/AndroidRuntime(1547):     ... 4 more
  </code></pre>
  
  <p>this is Async Task</p>
  
  <pre><code>public void Gtalk_logInComplete(String Uname, XMPPConnection _connection) {
        Log.i(TAG, "Uname" +Uname);
        Uname = current_username;
        _connection = current_connection;
        ForwardAction task = new ForwardAction(); // this is line no 579
        task.execute();    
  }
  
  private class ForwardAction extends AsyncTask&lt;Void, Void, Void&gt; {          
      private ArrayList&lt;String&gt; contactJids;
      private GmailXmppClient Gtalk_xmpp_client;
      private ArrayList&lt;String&gt; contactNames;
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          show();
      }
  
      protected Void doInBackground(Void... params) {
  
   //         new Thread() {
   //             public void run() {
  
                  synchronized (this.contactJids) {
                      Roster roster = this.Gtalk_xmpp_client.getRoster();
                      String file_name;
                      for (RosterEntry entry : roster.getEntries()) {
                          if (entry.getType() == ItemType.to || entry.getType() == ItemType.both) {
  
                              this.contactJids.add(entry.getUser());
                              this.contactNames.add(entry.getName());                         
  
                              contact_db.open();
                              boolean yes = contact_db.checkUsername(entry.getUser());
                              Log.i(TAG, "Con=" + yes);
                              if (!yes) {
  
                                  Bitmap buddy_img = buddyImage(entry, current_connection);
                                  if (buddy_img != null)
                                      file_name = Store(buddy_img);
                                  else
                                      file_name = "";
                                  if (entry.getName() == null)
                                      contact_db.createContact(entry.getUser(), entry.getUser(), current_username, file_name, "GOOGLE");
                                  else
                                      contact_db.createContact(entry.getName(), entry.getUser(), current_username, file_name, "GOOGLE");
                              } else {
                                  Log.i(TAG, "Con=exist");
                              }
                          }
                      }
                  } 
      //      }
  //      }.start();                      
          contact_db.close();         
          return null;
      }
  
      protected void onPostExecute(Void aVoid) {          
          super.onPostExecute(aVoid);       
          hide();
      }        
  }
  </code></pre>