Use intention to open contacts?

I am trying to associate one of my buttons with an intention to open the contacts application on my device. Any help on how to use intent or another method to discover it?

public class MainActivity extends Activity implements View.OnClickListener { View v; Button contacts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getContacts(); contacts.setOnClickListener(this); } private void getContacts() { // TODO Auto-generated method stub contacts = (Button) findViewById(R.id.bcontacts); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.bcontacts: intent contacts = new Intent \\this is where i dont know what to do break; } } 

}

+4
source share
1 answer

This should do the trick for you:

 Intent intent= new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI); startActivityForResult(intent, PICK_CONTACT); 
+1
source

All Articles