title: Multi-select Android Contacts and Save in ArrayList
body: <p>I want to save the selected native Contacts from to the SQLite Database, able to get a contact from onActivityResult method, but I want to multiSelect the Contacts and store it in an ArrayList. Here is my code. Please let me know the possible way to solve the issue.</p>
  
  <pre><code> Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
  
          startActivityForResult(intent, PICK_CONTACT);
  
          Cursor cursor = getContentResolver().query(   ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null,null, null);
          while (cursor.moveToNext()) {
              String name =cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
              String phoneNumber = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
        }
  </code></pre>
  
  <p>And onActivityResult method is given Below</p>
  
  <pre><code>  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
       String pathToOurFile = Environment.getExternalStorageDirectory().getPath() + "/dcim/camera/" + imgName;
       new ImageUploadTask().execute();
       switch(requestCode){
          case 1: {       
  
             if (resultCode == Activity.RESULT_OK)
             {
                 Uri contactData = data.getData();
                 Cursor c = managedQuery(contactData, null, null, null, null);
                  if (c.moveToFirst())
                  {
                      String id = c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts._ID));
  
                      String hasPhone = c.getString(c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
  
                      if (hasPhone.equalsIgnoreCase("1")) 
                      {
                          Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null, 
                                 ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ id,null, null);
                          phones.moveToFirst();
                          String cNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                           Toast.makeText(getApplicationContext(), cNumber, Toast.LENGTH_SHORT).show();
  
                          String nameContact = c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
                          Log.d("Contact Testing ", nameContact);
                          Toast.makeText(getApplicationContext(), nameContact, Toast.LENGTH_SHORT).show();
                          //editText.setText(nameContact+ " "+ cNumber);
                      }
                 }
           }
          }
      }
      }
  </code></pre>