2014-06-16 2 views

답변

-3

확인 : 여기

내가 만들려는 정확히의 사진입니다. 결과
  • 에 대한

    1. 화재 의도 의도 결과 코드를 찾고 결과에 대한 의도를받을 : 당신은 너무 여기에 단계가 있다면 .. 네이티브 안드로이드 연락처 목록을 사용하고 싶습니다.
    2. 커서를 연락처 정보와 함께 반환
    3. 값을 설정하십시오.

    간단한 예. 화재 의도

    Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.Phone.CONTENT_URI); 
    startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT); 
    
    //Receive the result 
    public void onActivityResult(int requestCode, int resultCode, Intent data) { 
        super.onActivityResult(requestCode, resultCode, data); 
        if (resultCode == Activity.RESULT_OK) { 
         switch (requestCode) { 
          case CONTACT_PICKER_RESULT: 
           //deal with the resulting contact info. I built a separate util class for that.. but here is an example of the code. 
           String[] projection = { ContactsContract.CommonDataKinds.Phone._ID, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, 
            ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Email.ADDRESS }; 
           Uri result = data.getData(); 
           String id = result.getLastPathSegment(); 
           ContentResolver contentResolver = getActivity().getContentResolver(); 
    
           //return cursor 
           cur = contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projection, 
             ContactsContract.CommonDataKinds.Phone._ID + " like \"" + idUser + "%\"", null, null); 
           //Use the cursor to return what you need. 
         } 
        } 
    

    다음은 커서를 호출하는 예입니다. 안드로이드 워드 프로세서에서 연락처 커서에 대해 좀 더 읽어보십시오.

  • +1

    내 질문에 대한 답장을 보내 주셔서 감사합니다. 네이티브 안드로이드에 연락처를 작성하고 싶지만 스카이프와 마찬가지로 연락처 목록에도 내 자신의 앱 아이콘이 있습니다. –

    +1

    내 목표는 네이티브 android 앱의 연락처를 사용하는 것이 아니라 내 앱 아이콘으로 앱에 연락처를 삽입하는 것입니다. –

    +0

    내가 확신하는 API가 있습니다. 나는 그것을 사용하지 않았다. 그래서 나는 정말로 도움이되지 못합니다. 좀 더 읽고 ... !!! – HackerMaker36

    관련 문제