0

I am trying to make an app that, when a button is pressed, the contact list is pulled up, and when a contact is selected, it opens the contact for viewing. 目前,我可以拉出联系人列表,但是一旦我选择了姓名,它就会返回按钮屏幕。这里有什么帮助吗?这是我的代码

public class TestStuff extends Activity implements OnClickListener{


    private static final int PICK_CONTACT = 0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button contacts = (Button) findViewById(R.id.bContacts);
        contacts.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub



        Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
        startActivityForResult(intent, PICK_CONTACT);   


    }



}
4

1 回答 1

0

当您使用该startActivityForResult方法启动结果活动时,假设以所需结果返回您之前的活动,在这种情况下,我猜结果将是您选择的联系人姓名,我没有太多经验联系人 API,但我想有一种方法可以提取您需要的有关单个联系人的所有数据。

于 2013-07-11T20:49:42.647 回答