2
  1. 연락처를 선택하려면 검색 필드를 사용하여 응용 프로그램에서 연락처 선택을 프로그래밍 방식으로 입력해야합니다. 누군가 내가 사용하는 URI 나 의도의 추가로 넣을 것을 제안 할 수 있습니까?프로그래밍 방식으로 입력 한 검색 필터로 프로그램 방식으로 연락처 선택을 여는 방법은 무엇입니까?

    private static final int PICK_CONTACT_SUBACTIVITY = 2; 
    private void startContactActivity() { 
        Uri uri = Uri.parse("content://contacts/people"); 
        // Here in this normally we pass number e.g. Uri.encode("987") but i want to pass name as filter is it possible? 
        // I have also tried 
        //uri = Uri.withAppendedPath(android.provider.ContactsContract.Contacts.CONTENT_FILTER_URI, Uri.encode("pra")); 
        //uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode("pra")); 
        uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_FILTER_URI, Uri.encode("pra")); 
    
        Intent intent = new Intent(Intent.ACTION_PICK, uri); 
        startActivityForResult(intent, PICK_CONTACT_SUBACTIVITY); 
    } 
    

사람 내가 이것을 달성하는 방법을 제안 할 수 있습니다?

답변

0

프로그래밍 방식으로 필터를 지정할 수 없습니다 것으로 보인다.

ACTION_PICK 당신은 Contacts.CONTENT_URI, Phone.CONTENT_URI, StructuredPostal.CONTENT_URI, Email.CONTENT_URI 중 하나를 사용할 수 있습니다 Android SDK documentation states (in the chapter "Retrieval and modification with intents")있다. 이것은 간접적으로 필터 (전화 번호가있는 모든 연락처, 우편 주소가있는 모든 연락처 또는 이메일이있는 모든 연락처)이지만이 주소로만 제한됩니다.