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


Java Contacts.CONTENT_URI属性代码示例

本文整理汇总了Java中android.provider.ContactsContract.Contacts.CONTENT_URI属性的典型用法代码示例。如果您正苦于以下问题:Java Contacts.CONTENT_URI属性的具体用法?Java Contacts.CONTENT_URI怎么用?Java Contacts.CONTENT_URI使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.provider.ContactsContract.Contacts的用法示例。


在下文中一共展示了Contacts.CONTENT_URI属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareAddContactIntent

public static Intent prepareAddContactIntent(String displayName, String sipUri) {
	Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
	intent.putExtra(Insert.NAME, displayName);
	
	if (sipUri != null && sipUri.startsWith("sip:")) {
		sipUri = sipUri.substring(4);
	}
	
	ArrayList<ContentValues> data = new ArrayList<ContentValues>();
	ContentValues sipAddressRow = new ContentValues();
	sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE);
	sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri);
	data.add(sipAddressRow);
	intent.putParcelableArrayListExtra(Insert.DATA, data);
	
	return intent;
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:17,代码来源:ApiElevenPlus.java

示例2: prepareEditContactIntentWithSipAddress

public static Intent prepareEditContactIntentWithSipAddress(int id, String sipUri) {
	Intent intent = new Intent(Intent.ACTION_EDIT, Contacts.CONTENT_URI);
	Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id);
	intent.setData(contactUri);
	
	ArrayList<ContentValues> data = new ArrayList<ContentValues>();
	ContentValues sipAddressRow = new ContentValues();
	sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE);
	sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri);
	data.add(sipAddressRow);
	intent.putParcelableArrayListExtra(Insert.DATA, data);
	
	return intent;
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:14,代码来源:ApiElevenPlus.java

示例3: getAddContactIntent

@Override
public Intent getAddContactIntent(String displayName, String csipUri) {
    Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT, Contacts.CONTENT_URI);
    intent.setType(Contacts.CONTENT_ITEM_TYPE);

    if (!TextUtils.isEmpty(displayName)) {
        intent.putExtra(Insert.NAME, displayName);
    }

    if (!TextUtils.isEmpty(csipUri)) {
        ArrayList<ContentValues> data = new ArrayList<ContentValues>();
        ContentValues csipProto = new ContentValues();
        csipProto.put(Data.MIMETYPE, CommonDataKinds.Im.CONTENT_ITEM_TYPE);
        csipProto.put(CommonDataKinds.Im.PROTOCOL, CommonDataKinds.Im.PROTOCOL_CUSTOM);
        csipProto.put(CommonDataKinds.Im.CUSTOM_PROTOCOL, SipManager.PROTOCOL_CSIP);
        csipProto.put(CommonDataKinds.Im.DATA, SipUri.getCanonicalSipContact(csipUri, false));
        data.add(csipProto);

        intent.putParcelableArrayListExtra(Insert.DATA, data);
    }

    return intent;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:23,代码来源:ContactsUtils5.java

示例4: onCreateLoader

@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
	Uri baseUri;

	if (mSearchString != null) {
           baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI,
                   Uri.encode(mSearchString));
       } else {
           baseUri = Contacts.CONTENT_URI;
       }

	String selection = "((" + DISPLAY_NAME_COMPAT + " NOTNULL) AND ("
			+ Contacts.HAS_PHONE_NUMBER + "=1) AND ("
			+ DISPLAY_NAME_COMPAT + " != '' ))";

	String sortOrder = Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";

	return new CursorLoader(getActivity(), baseUri, CONTACTS_SUMMARY_PROJECTION, selection, null, sortOrder);
}
 
开发者ID:vaslabs,项目名称:SDC,代码行数:19,代码来源:ContactsListFragment.java

示例5: 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(Contacts.CONTENT_FILTER_URI,
                Uri.encode(mCurFilter));
    } else {
        baseUri = Contacts.CONTENT_URI;
    }

    // Now create and return a CursorLoader that will take care of
    // creating a Cursor for the data being displayed.
    String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND ("
            + Contacts.HAS_PHONE_NUMBER + "=1) AND ("
            + Contacts.DISPLAY_NAME + " != '' ))";
    return new CursorLoader(getActivity(), baseUri,
            CONTACTS_SUMMARY_PROJECTION, select, null,
            Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC");
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:22,代码来源:LoaderCursor.java

示例6: onOptionsItemSelected

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        // Sends a request to the People app to display the create contact screen
        case R.id.menu_add_contact:
            final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
            startActivity(intent);
            break;
        // For platforms earlier than Android 3.0, triggers the search activity
        case R.id.menu_search:
            if (!Utils.hasHoneycomb()) {
                getActivity().onSearchRequested();
            }
            break;
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:aarya123,项目名称:CampusFeedv2,代码行数:17,代码来源:ContactsListFragment.java

示例7: pickContactAsync

/**
 * Launches the Contact Picker to select a single contact.
 */
private void pickContactAsync() {
    final CordovaPlugin plugin = (CordovaPlugin) this;
    Runnable worker = new Runnable() {
        public void run() {
            Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
            plugin.cordova.startActivityForResult(plugin, contactPickerIntent, CONTACT_PICKER_RESULT);
        }
    };
    this.cordova.getThreadPool().execute(worker);
}
 
开发者ID:rodrigonsh,项目名称:alerta-fraude,代码行数:13,代码来源:ContactManager.java

示例8: pickContact

@ReactMethod
public void pickContact(final Promise promise) {
    Activity currentActivity = getCurrentActivity();
    Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
            Contacts.CONTENT_URI);
    mContactPickerPromise = promise;
    currentActivity.startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);

}
 
开发者ID:doctadre,项目名称:react-native-contact-picker,代码行数:9,代码来源:ContactPickerModule.java

示例9: pickContacts

private void pickContacts ()
{
    // Here, thisActivity is the current activity
    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.READ_CONTACTS)
            != PackageManager.PERMISSION_GRANTED) {

        // Should we show an explanation?
        if (ActivityCompat.shouldShowRequestPermissionRationale(this,
                Manifest.permission.READ_CONTACTS)) {

            // Show an expanation to the user *asynchronously* -- don't block
            // this thread waiting for the user's response! After the user
            // sees the explanation, try again to request the permission.

        } else {

            // No explanation needed, we can request the permission.

            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.READ_CONTACTS},
                    MY_PERMISSIONS_REQUEST_READ_CONTACTS);

            // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
            // app-defined int constant. The callback method gets the
            // result of the request.
        }
    }
    else
    {
        Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
        startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);
    }
}
 
开发者ID:n8fr8,项目名称:PanicKitSamples,代码行数:34,代码来源:MainActivity.java

示例10: pickContact

/**
 * <p>Pick contact from list.</p>
 */
private void pickContact () {

	// start "pick" activity.
	Intent intent = new Intent (Intent.ACTION_PICK, Contacts.CONTENT_URI);
	startActivityForResult (intent, PICK_CONTACT_FROM_LIST);
}
 
开发者ID:bfix,项目名称:ringcode-android,代码行数:9,代码来源:AssignmentEditor.java

示例11: showUpdateContactLink

protected void showUpdateContactLink(long recipientRowId) {
    mContactLinkRecipientRowId = recipientRowId;
    Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
    boolean actionAvailable = getPackageManager().resolveActivity(intent, 0) != null;
    if (actionAvailable) {
        startActivityForResult(intent, RESULT_SELECT_CONTACT_LINK);
    } else {
        showNote(SafeSlinger.getUnsupportedFeatureString("Pick Contact"));
    }
}
 
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:10,代码来源:BaseActivity.java

示例12: showPickContact

private void showPickContact(int requestCode) {
    Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
    boolean actionAvailable = getPackageManager().resolveActivity(intent, 0) != null;
    if (actionAvailable) {
        startActivityForResult(intent, requestCode);
    } else {
        showNote(SafeSlinger.getUnsupportedFeatureString("Pick Contact"));
    }
}
 
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:9,代码来源:HomeActivity.java

示例13: onClick

@Override
public void onClick(View v) {
    if(v.getId() == btnContactPicker.getId()) {
        Intent contactsIntent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
        startActivityForResult(contactsIntent, ACTIVITYRESULT_CONTACTPICKER);
    } else if(v.getId() == btnStart.getId()) {
        if(txtAmmountOfMessages.getText().toString().equals("") || txtMessage.getText().toString().equals("") || txtPhoneNb.getText().toString().equals("")) {
            Toast.makeText(this, getString(R.string.errorFillAllFields), Toast.LENGTH_LONG).show();
        } else {
            initTimer();
        }
    } else if(v.getId() == btnStop.getId()) {
        cancelTimer();
    }
}
 
开发者ID:tiphedor,项目名称:SMS-Spammer-Android,代码行数:15,代码来源:MainActivity.java

示例14: getPickContactIntent

/**
 * Returns a Pick Contact intent using the Eclair "contacts" URI.
 */
@Override
public Intent getPickContactIntent() {
    return new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:7,代码来源:ContactAccessorSdk5.java

示例15: getPickContactIntent

/**
 * Returns a Pick Contact intent using the Eclair "contacts" URI.
 */
public Intent getPickContactIntent() {
    return new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
}
 
开发者ID:lebesnec,项目名称:Poker-Director,代码行数:6,代码来源:ContactAccessor.java


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