title: Java android how to use contact picker
body: <p>I programm an App to send SMS for an association and I need your help...
  I want to retrieve the mobile number from a contact by the contact picker. I can not retrieve the result of the user selection...</p>
  
  <p>My code:</p>
  
  <pre><code>public class MainActivity extends Activity {
      private static final int CONTACT_PICKER_RESULT = 0;
      private Button contacts = null;
      private Button envoyer = null;
      private TextView mobile = null;
      private int PICK_CONTACT;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          // Elements of th activity
          contacts = (Button) findViewById(R.id.contacts);
          envoyer = (Button) findViewById(R.id.envoyer);
          mobile = (TextView) findViewById(R.id.mobile);
  
  
  
          contacts.setOnClickListener(new OnClickListener() {
              public void onClick(View v) {
                  Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, Phone.CONTENT_URI);  
                  startActivityForResult(contactPickerIntent, 1001); 
              }
          });
  
          envoyer.setOnClickListener(new OnClickListener() {
              public void onClick(View v) {
  
  
  
              }
          });
  
      }
  
  
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
        // How to retrieve the mobile and the name of the contact selected ?
      }
  
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
  
  
      public void open_contacts(){
  
  
      }
  
  
  }
  </code></pre>
  
  <p>Thanks you very much... !</p>