本文整理汇总了Java中android.provider.Contacts.People.CONTENT_URI属性的典型用法代码示例。如果您正苦于以下问题:Java People.CONTENT_URI属性的具体用法?Java People.CONTENT_URI怎么用?Java People.CONTENT_URI使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.Contacts.People
的用法示例。
在下文中一共展示了People.CONTENT_URI属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateLoader
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
// This is called when a new Loader needs to be created. This
// sample only has one Loader, so we don't care about the ID.
// First, pick the base URI to use depending on whether we are
// currently filtering.
Uri baseUri;
if (mCurFilter != null) {
baseUri = Uri.withAppendedPath(People.CONTENT_FILTER_URI, Uri.encode(mCurFilter));
} else {
baseUri = People.CONTENT_URI;
}
// Now create and return a CursorLoader that will take care of
// creating a Cursor for the data being displayed.
String select = "((" + People.DISPLAY_NAME + " NOTNULL) AND ("
+ People.DISPLAY_NAME + " != '' ))";
return new CursorLoader(getActivity(), baseUri,
CONTACTS_SUMMARY_PROJECTION, select, null,
People.DISPLAY_NAME + " COLLATE LOCALIZED ASC");
}
示例2: buildUI
/**
* {@inheritDoc}
*/
public View buildUI(DataType initData) {
if (initData != null) {
editText.setText(initData.getValue());
}
ContentResolver cr = activity.getContentResolver();
List<String> contacts = new ArrayList<String>();
// Form an array specifying which columns to return.
String[] projection = new String[] {People.NAME, People.NUMBER };
// Get the base URI for the People table in the Contacts content provider.
Uri contactsUri = People.CONTENT_URI;
// Make the query.
Cursor cursor = cr.query(contactsUri,
projection, // Which columns to return
null, // Which rows to return (all rows)
null, // Selection arguments (none)
Contacts.People.DEFAULT_SORT_ORDER);
if (cursor.moveToFirst()) {
String name;
String phoneNumber;
int nameColumn = cursor.getColumnIndex(People.NAME);
int phoneColumn = cursor.getColumnIndex(People.NUMBER);
do {
// Get the field values of contacts
name = cursor.getString(nameColumn);
phoneNumber = cursor.getString(phoneColumn);
contacts.add(name + ": " + phoneNumber);
} while (cursor.moveToNext());
}
cursor.close();
String[] contactsStr = new String[]{};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(activity,
android.R.layout.simple_dropdown_item_1line, contacts.toArray(contactsStr));
editText.setAdapter(adapter);
editText.setThreshold(1);
return(editText);
}
示例3: getPeopleFilterUri
private Uri getPeopleFilterUri(String filter) {
if (!TextUtils.isEmpty(filter)) {
return Uri.withAppendedPath(People.CONTENT_FILTER_URI, Uri.encode(filter));
} else {
return People.CONTENT_URI;
}
}
示例4: callContactsManager
public void callContactsManager() {
final Uri uri = People.CONTENT_URI;
final Intent intent = new Intent(Intent.ACTION_PICK, uri);
final Activity activity = (Activity) webView.getContext();
activity.startActivityForResult(intent, ActivityRequestCode.SELECT_CONTRACT);
}
示例5: getPickContactIntent
/**
* Returns a Pick Contact intent using the pre-Eclair "people" URI.
*/
@Override
public Intent getPickContactIntent() {
return new Intent(Intent.ACTION_PICK, People.CONTENT_URI);
}