当前位置: 首页>>代码示例>>Java>>正文


Java People.CONTENT_URI属性代码示例

本文整理汇总了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");
}
 
开发者ID:reknih,项目名称:informant-droid,代码行数:20,代码来源:LoaderRetainedSupport.java

示例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);
}
 
开发者ID:biotinker,项目名称:LibreTasks,代码行数:42,代码来源:PhoneNumberViewItem.java

示例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;
    }
}
 
开发者ID:SpencerRiddering,项目名称:flingtap-done,代码行数:7,代码来源:ContactsListActivity.java

示例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);
}
 
开发者ID:drdrej,项目名称:android-webview-example,代码行数:7,代码来源:CreateCreditControl.java

示例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);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:7,代码来源:ContactAccessorSdk3_4.java


注:本文中的android.provider.Contacts.People.CONTENT_URI属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。