如何将选定的联系人导入我的应用程序?

时间:2017-08-31 12:58:22

标签: java android listview import-contacts

Java代码: `

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            // Inflate the layout for this fragment
            viewRoot = inflater.inflate(R.layout.fragment_contacts, container, 
            false);
            Button btnAdd = (Button) viewRoot.findViewById(R.id.btn_add_contacts);
            btnAdd.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(Intent.ACTION_PICK, 
                    ContactsContract.Contacts.CONTENT_URI);
                    startActivityForResult(intent,1);
                    Toast.makeText(getContext(), "Add Contacts", 
                    Toast.LENGTH_SHORT).show();
                }
            });
            return viewRoot;
        }

`
现在我想从列表中选择联系人,然后将它们添加到列表视图中。

0 个答案:

没有答案