本文整理匯總了Java中android.provider.ContactsContract.Contacts.CONTACT_STATUS屬性的典型用法代碼示例。如果您正苦於以下問題:Java Contacts.CONTACT_STATUS屬性的具體用法?Java Contacts.CONTACT_STATUS怎麽用?Java Contacts.CONTACT_STATUS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.provider.ContactsContract.Contacts
的用法示例。
在下文中一共展示了Contacts.CONTACT_STATUS屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onActivityCreated
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),
android.R.layout.simple_list_item_2, null,
new String[] { Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS },
new int[] { android.R.id.text1, android.R.id.text2 }, 0);
setListAdapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}
示例2: getContactsByGroup
@Override
public Cursor getContactsByGroup(Context ctxt, String groupName) {
if (TextUtils.isEmpty(groupName)) {
return null;
}
String[] projection;
if (Compatibility.isCompatible(11)) {
projection = new String[] {
Contacts._ID,
Contacts.DISPLAY_NAME,
Contacts.PHOTO_ID,
Contacts.CONTACT_STATUS_ICON,
Contacts.CONTACT_STATUS,
Contacts.CONTACT_PRESENCE,
Contacts.PHOTO_URI
};
} else {
projection = new String[] {
Contacts._ID,
Contacts.DISPLAY_NAME,
Contacts.PHOTO_ID,
Contacts.CONTACT_STATUS,
Contacts.CONTACT_PRESENCE
};
}
Uri searchUri = Uri.withAppendedPath(Contacts.CONTENT_GROUP_URI, Uri.encode(groupName));
Cursor c = null;
try {
c = ctxt.getContentResolver().query(searchUri, projection, null, null,
Contacts.DISPLAY_NAME + " ASC");
} catch(Exception e) {
Log.e(THIS_FILE, "Error while retrieving group", e);
}
return c;
}
示例3: onActivityCreated
@Override public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// In this sample we are going to use a retained fragment.
setRetainInstance(true);
// Give some text to display if there is no data. In a real
// application this would come from a resource.
setEmptyText("No phone numbers");
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
// Create an empty adapter we will use to display the loaded data.
mAdapter = new SimpleCursorAdapter(getActivity(),
android.R.layout.simple_list_item_2, null,
new String[] { Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS },
new int[] { android.R.id.text1, android.R.id.text2 }, 0);
setListAdapter(mAdapter);
// Start out with a progress indicator.
setListShown(false);
// Prepare the loader. Either re-connect with an existing one,
// or start a new one.
getLoaderManager().initLoader(0, null, this);
}