Getting Number from Contacts Picker

前端 未结 5 1999
無奈伤痛
無奈伤痛 2020-12-05 05:55

I am trying to get a contacts name and phone number after a user has picked a contact from the Contact Picker. I am attempting to make my application work for SDK v3 and up

5条回答
  •  一整个雨季
    2020-12-05 06:48

    I dint get that line case CONTACT_PICKER_RESULT...the code i used above using this

    int PICK_CONTACT;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            b=(Button) findViewById(R.id.button1);
             et=(EditText) findViewById(R.id.editText1);
            b.setOnClickListener(this);
            //et.setOnClickListener(this);
    
                }
    
    @Override
    public void onClick(View v) {
        switch(v.getId())
        {
        case R.id.button1:
            Intent intent = new Intent(Intent.ACTION_PICK);
            intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
            startActivityForResult(intent, PICK_CONTACT);
    
            break;
       // case R.id.editText1:
    
    
    
          //  break;
    
        }
    

提交回复
热议问题