當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。