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


Java People类代码示例

本文整理汇总了Java中android.provider.Contacts.People的典型用法代码示例。如果您正苦于以下问题:Java People类的具体用法?Java People怎么用?Java People使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: bindContactPhoneView

import android.provider.Contacts.People; //导入依赖的package包/类
@Override
public void bindContactPhoneView(View view, Context context, Cursor cursor) {
    
    // Get values
    String value = cursor.getString(cursor.getColumnIndex(Phones.NUMBER));
    String displayName = cursor.getString(cursor.getColumnIndex(Phones.DISPLAY_NAME));
    Long peopleId = cursor.getLong(cursor.getColumnIndex(Phones.PERSON_ID));
    Uri uri = ContentUris.withAppendedId(People.CONTENT_URI, peopleId);
    Bitmap bitmap = getContactPhoto(context, uri, false, R.drawable.ic_contact_picture_holo_dark);
    
    // Get views
    TextView tv = (TextView) view.findViewById(R.id.name);
    TextView sub = (TextView) view.findViewById(R.id.number);
    TextView label = (TextView) view.findViewById(R.id.label);
    ImageView imageView = (ImageView) view.findViewById(R.id.contact_photo);
    
    // Bind
    label.setVisibility(View.GONE);
    view.setTag(value);
    tv.setText(displayName);
    sub.setText(value);
    imageView.setImageBitmap(bitmap);        
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:24,代码来源:ContactsUtils3.java

示例2: create

import android.provider.Contacts.People; //导入依赖的package包/类
public void create(Contact newPhoneContact) throws Exception {
    // first, we have to create the contact
    ContentValues newPhoneValues = new ContentValues();
    newPhoneValues.put(Contacts.People.NAME, newPhoneContact.getName());
    Uri newPhoneRow = resolver.insert(Contacts.People.CONTENT_URI, newPhoneValues);

    // then we have to add a number
    newPhoneValues.clear();
    newPhoneValues.put(Contacts.People.Phones.TYPE, Contacts.People.Phones.TYPE_MOBILE);
    newPhoneValues.put(Contacts.Phones.NUMBER, newPhoneContact.getNumber());
    // insert the new phone number in the database using the returned uri from creating the contact
    newPhoneRow = resolver.insert(Uri.withAppendedPath(newPhoneRow, Contacts.People.Phones.CONTENT_DIRECTORY), newPhoneValues);

    // if contacts uri returned, there was an error with adding the number
    if (newPhoneRow.getPath().contains("people")) {
        throw new Exception(String.valueOf(R.string.error_phone_number_not_stored));
    }

    // if phone uri returned, everything went OK
    if (!newPhoneRow.getPath().contains("phones")) {
        // some unknown error has happened
        throw new Exception(String.valueOf(R.string.error_phone_number_error));
    }
}
 
开发者ID:yeriomin,项目名称:DumbphoneAssistant,代码行数:25,代码来源:PhoneUtilDonut.java

示例3: retrieveContactUri

import android.provider.Contacts.People; //导入依赖的package包/类
public Uri retrieveContactUri(Contact contact) {
    String id = contact.getId();
    String[] projection = new String[] { Contacts.Phones.PERSON_ID };
    String path = null;
    Cursor result;
    if (null != id) {
        Uri uri = ContentUris.withAppendedId(Contacts.Phones.CONTENT_URI, Long.valueOf(id));
        result = resolver.query(uri, projection, null, null, null);
    } else {
        String selection = "name='?' AND number='?'";
        String[] selectionArgs = new String[] { contact.getName(), contact.getNumber() };
        result = resolver.query(Contacts.Phones.CONTENT_URI, projection, selection, selectionArgs, null);
    }
    if (null != result) {
        result.moveToNext();
        path = result.getString(0);
        result.close();
    }
    if (null == path) {
        return null;
    }
    return Uri.withAppendedPath(Contacts.People.CONTENT_URI, path);
}
 
开发者ID:yeriomin,项目名称:DumbphoneAssistant,代码行数:24,代码来源:PhoneUtilDonut.java

示例4: assignRingtoneToContact

import android.provider.Contacts.People; //导入依赖的package包/类
private void assignRingtoneToContact() {
    Cursor c = mAdapter.getCursor();
    int dataIndex = c.getColumnIndexOrThrow(People._ID);
    String contactId = c.getString(dataIndex);

    dataIndex = c.getColumnIndexOrThrow(People.DISPLAY_NAME);
    String displayName = c.getString(dataIndex);

    Uri uri = Uri.withAppendedPath(getContactContentUri(), contactId);

    ContentValues values = new ContentValues();
    values.put(People.CUSTOM_RINGTONE, mRingtoneUri.toString());
    getContentResolver().update(uri, values, null, null);

    String message =
            getResources().getText(R.string.success_contact_ringtone) +
                    " " +
                    displayName;
    Log.i("Contact Uri", uri.toString());
    Log.i("Ringtone Uri", mRingtoneUri.toString());

    Toast.makeText(this, message, Toast.LENGTH_SHORT)
            .show();
    finish();
    return;
}
 
开发者ID:Ag47,项目名称:TrueTone,代码行数:27,代码来源:ChooseContactActivity.java

示例5: onCreateLoader

import android.provider.Contacts.People; //导入依赖的package包/类
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,代码行数:21,代码来源:LoaderRetainedSupport.java

示例6: onActivityCreated

import android.provider.Contacts.People; //导入依赖的package包/类
@Override public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Give some text to display if there is no data.  In a real
    // application this would come from a resource.
    setEmptyText("No phone numbers");

    // We have a menu item to show in action bar.
    setHasOptionsMenu(true);

    // Create an empty adapter we will use to display the loaded data.
    mAdapter = new SimpleCursorAdapter(getActivity(),
            android.R.layout.simple_list_item_1, null,
            new String[] { People.DISPLAY_NAME },
            new int[] { android.R.id.text1}, 0);
    setListAdapter(mAdapter);

    // Start out with a progress indicator.
    setListShown(false);

    // Prepare the loader.  Either re-connect with an existing one,
    // or start a new one.
    getLoaderManager().initLoader(0, null, this);
}
 
开发者ID:reknih,项目名称:informant-droid,代码行数:25,代码来源:LoaderCursorSupport.java

示例7: returnPickerResult

import android.provider.Contacts.People; //导入依赖的package包/类
private void returnPickerResult(String name, Uri uri) {
        final Intent intent = new Intent();
    
        if (mCreateShortcut) {
            Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, uri);
            shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
            intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
            final Bitmap icon = People.loadContactPhoto(this, uri, 0, null);
            if (icon != null) {
                intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
            } else {
                intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                        Intent.ShortcutIconResource.fromContext(this,
//                                R.drawable.ic_launcher_shortcut_contact));
                                R.drawable.picture_holder));
            }
            setResult(RESULT_OK, intent);
        } else {
            setResult(RESULT_OK, intent.setData(uri));
        }
        finish();
    }
 
开发者ID:SpencerRiddering,项目名称:flingtap-done,代码行数:24,代码来源:ContactsListActivity.java

示例8: isExcludedType

import android.provider.Contacts.People; //导入依赖的package包/类
boolean isExcludedType(Vector<Integer> vExTypesCode, String sNumber, Context oContext)
  {
  	Uri contactRef = Uri.withAppendedPath(Contacts.Phones.CONTENT_FILTER_URL, sNumber);
  	final String[] PHONES_PROJECTION = new String[] 
   {
       People.Phones.NUMBER, // 0
       People.Phones.TYPE, // 1
   };
      Cursor phonesCursor = oContext.getContentResolver().query(contactRef, PHONES_PROJECTION, null, null,
              null);
if (phonesCursor != null) 
      {	        			
           while (phonesCursor.moveToNext()) 
          { 			            	
              final int type = phonesCursor.getInt(1);	              
              if(vExTypesCode.contains(Integer.valueOf(type)))
              	return true;	    
          }
          phonesCursor.close();
      }
return false;
  }
 
开发者ID:bigbn,项目名称:phonty,代码行数:23,代码来源:Caller.java


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