title: How to search number from contacts in android?
body: <p>I am developing an application in that I have to search numbers from contacts and add that contact to my edit text. I wrote some code it go to contacts but not add in edit text please tell me any mistake in my code</p>
  
  <p>my code</p>
  
  <pre><code>  searchBtn.setOnClickListener(new OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
  
              intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
              startActivityForResult(intent,1);
          }
      });
  
       @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      if(requestCode == RESULT_OK){
           Uri contactData = data.getData();
           Cursor cursor = managedQuery(contactData, null, null, null, null);
           cursor.moveToFirst();
           String number = cursor.getString(cursor.getColumnIndexOrThrow
                   (ContactsContract.CommonDataKinds.Phone.NUMBER));
  
          //contactName.setText(name);
          ephoneNumber.setText(number);
          //contactEmail.setText(email);
      }
  }
  </code></pre>