title: use onActivityResult method in custom view
body: <p>I have a custom view that extends LinearLayot and it has one button and one edit text. i want when user clickes on button, contacts book will open and when user selects a number, the number will show in edit text. i used this code:</p>
  
  <pre><code>private void pickContact() {
      Intent pickContactIntent = new Intent(Intent.ACTION_PICK, Uri.parse("content://contacts"));
      pickContactIntent.setType(Phone.CONTENT_TYPE); // Show user only contacts w/ phone numbers
      startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST);
  }
  
   @Override
   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
       if (requestCode == PICK_CONTACT_REQUEST) {
           if (resultCode == RESULT_OK) {
               Uri contactUri = data.getData();
               String[] projection = {Phone.NUMBER};
  
               Cursor cursor = getContentResolver()
                       .query(contactUri, projection, null, null, null);
               cursor.moveToFirst();
  
               int column = cursor.getColumnIndex(Phone.NUMBER);
               String number = cursor.getString(column);
  
           }
       }
   }
  </code></pre>
  
  <p>Because my class extends LinearLayout, i can't use onActivityResult method. can any body hel me?
  tahnks</p>