시작 궁극적으로 당신은 위의 코드는 커서
에 아래의 인터페이스를 사용하여 이름을 가진 모든 전화 번호를 retrives
new CursorLoader(getActivity(),
contentUri,
ContactMobileNumbQuery.PROJECTION,
ContactMobileNumbQuery.SELECTION,
null,
ContactMobileNumbQuery.SORT_ORDER);
사용해야합니다
/**
* This interface defines constants used by mobile number retrieval queries.
*/
public interface ContactMobileNumbQuery{
final static int QUERY_ID = 1;
//A Content Uri for Phone table
final static Uri CONTENT_URI = Phone.CONTENT_URI;
//The search or filter query Uri
final static Uri FILTER_URI = Phone.CONTENT_FILTER_URI;
// The selection clause for the CursorLoader query. The search criteria defined here
// restrict results to contacts that have a phone number and display name.
// Notice that the search on the string provided by the user is implemented by appending
// the search string to CONTENT_FILTER_URI.
final static String SELECTION = Phone.HAS_PHONE_NUMBER + "=1" + " AND " + Phone.DISPLAY_NAME_PRIMARY + "<>''";
// The desired sort order for the returned Cursor - Order by DISPLAY_NAME_PRIMARY
//in Ascending with case insensitively
final static String SORT_ORDER = Phone.DISPLAY_NAME_PRIMARY + " COLLATE NOCASE ASC";
// The projection for the CursorLoader query. This is a list of columns that the Contacts
// Provider should return in the Cursor.
final static String[] PROJECTION = {
// The contact's row id
Phone._ID,
// the Contacts table contains DISPLAY_NAME_PRIMARY, which either contains
// the contact's displayable name or some other useful identifier such as an
// email address.
Phone.DISPLAY_NAME_PRIMARY,
// A pointer to the contact that is guaranteed to be more permanent than _ID. Given
// a contact's current _ID value and LOOKUP_KEY, the Contacts Provider can generate
// a "permanent" contact URI.
Phone.LOOKUP_KEY,
//Phone number of the contact
Phone.NUMBER,
};
// The query column numbers which map to each value in the projection
final static int ID = 0;
final static int DISPLAY_NAME = 1;
final static int LOOKUP_KEY = 2;
final static int NUMBER = 3;
}
동기 로직을 별도로 작성해야합니다. 그것을 시도하고 귀하의 의견을 게시 :)
헥타르 내가 많이 보자 :-))))))))))))))))))))) – user3781907
로 표시 올바른 답변 정말 문제를 해결하는 경우 :-) – Sathish