Hey there and welcome to StackOverflow AND Android development.
In order to open the contacts screen, you need to capture the OnClick
event for your button and create an intent to open the contact screen.
Something like this:
Button myButton = (Button) myLayout.findViewById(R.id.myButton);
myButton..setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent= new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
startActivity(intent);
}
});
If you want to do something with the contact that the user selects, use a startActivityForResult
instead and overwrite the onActivityResult
method (read more about that here.
Some similar answers can be found here and here!
Good luck!
1
solved How do I open the default contacts screen on Android? [closed]