title: Loading of activity is very slow
body: <p>Hi I am developing an android SMS app. I hav an activity which loads the contacts into mPeopleList ArrayList as in below code which is called in doInBackground</p>
  
  <pre><code>public void PopulatePeopleList()
  {
      mPeopleList.clear();
  
      Cursor people = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
  
      if(people.getCount() == 0)
      {
          //No contacts found
      }
  
      while (people.moveToNext())
      {
          String contactName = people.getString(people.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
          String contactId = people.getString(people.getColumnIndex(ContactsContract.Contacts._ID));
          String hasPhone = people.getString(people.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
  
          if ((Integer.parseInt(hasPhone) &gt; 0))
          {
  
              Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
                      ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,null, null);
              while (phones.moveToNext())
              {
  
                  //store numbers and display a dialog letting the user select which.
                  String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                  String numberType = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE));
  
                  Map&lt;String, String&gt; NamePhoneType = new HashMap&lt;String, String&gt;();
  
                  NamePhoneType.put("Name", contactName);
                  NamePhoneType.put("Phone", phoneNumber);
  
                  if(numberType.equals("0"))
                  {
                      NamePhoneType.put("Type", "Work");
                  }
                  else if(numberType.equals("1"))
                  {
                      NamePhoneType.put("Type", "Home");
                  }
                  else if(numberType.equals("2"))
                  {
                      NamePhoneType.put("Type",  "Mobile");
                  }
                  else
                  {
                      NamePhoneType.put("Type", "Other");
                  }
                  //Then add this map to the list.
                  mPeopleList.add(NamePhoneType);
              }
              phones.close();
          }
      }
      people.close();
  
      startManagingCursor(people);
  }
  </code></pre>
  
  <p>and on PostExecute setting it to adapter</p>
  
  <pre><code>mAdapter = new SimpleAdapter(this, mPeopleList, R.layout.custcontview ,new String[] { "Name", "Phone" , "Type" }, new int[] { R.id.ccontName, R.id.ccontNo, R.id.ccontType });
  mTxtPhoneNo.setAdapter(mAdapter);
  </code></pre>
  
  <p>I am calling the MyBackgroundTask() onCreate().</p>
  
  <p>The Second activity is loading very slowly. Not sure why there is this slow loading. </p>
  
  <p>Please Help how do I load the activity faster.</p>
  
  <p>Thanks!</p>