本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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"));
}
}
示例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"));
}
}
示例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();
}
}
示例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);
}
示例15: getPickContactIntent
/**
* Returns a Pick Contact intent using the Eclair "contacts" URI.
*/
public Intent getPickContactIntent() {
return new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
}