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


Java Phone.getTypeLabel方法代码示例

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


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

示例1: onItemSelected

import android.provider.ContactsContract.CommonDataKinds.Phone; //导入方法依赖的package包/类
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
    if (position >= 0) {
        //Get current cursor
        Cursor c = (Cursor) parent.getItemAtPosition(position);
        int type = c.getInt(COLUMN_PHONE_TYPE);
        String phone = c.getString(COLUMN_PHONE_NUMBER);
        String label = null;
        //Custom type? Then get the custom label
        if (type == Phone.TYPE_CUSTOM) {
            label = c.getString(COLUMN_PHONE_LABEL);
        }
        //Get the readable string
        String numberType = (String) Phone.getTypeLabel(getResources(), type, label);
        String text = numberType + ": " + phone;
        mPhone.setText(text);
    }
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:18,代码来源:List7.java

示例2: phoneTypeToString

import android.provider.ContactsContract.CommonDataKinds.Phone; //导入方法依赖的package包/类
public CharSequence phoneTypeToString(Context mContext, int type, CharSequence label) {
  return Phone.getTypeLabel(mContext.getResources(), type, label);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:4,代码来源:ContactAccessor.java

示例3: get

import android.provider.ContactsContract.CommonDataKinds.Phone; //导入方法依赖的package包/类
public ArrayList<Contact> get() {
    Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
    String[] projection = new String[] {
            PhoneLookup._ID,
            PhoneLookup.DISPLAY_NAME,
            ContactsContract.CommonDataKinds.Phone.TYPE,
            ContactsContract.CommonDataKinds.Phone.LABEL,
            ContactsContract.CommonDataKinds.Phone.NUMBER
    };
    String[] simTypesQueryParts = new String[simTypes.length];
    Arrays.fill(simTypesQueryParts, ContactsContract.RawContacts.ACCOUNT_TYPE + " <> ?");
    String simTypesQuery = TextUtils.join(" AND ", simTypesQueryParts);
    String selection = ContactsContract.RawContacts.ACCOUNT_TYPE + " IS NULL OR (" + simTypesQuery + ")";
    String[] selectionArgs = simTypes;

    Cursor results = resolver.query(
            uri,
            projection,
            selection,
            selectionArgs,
            null
    );

    // create array of Phone contacts and fill it
    final ArrayList<Contact> phoneContacts = new ArrayList<>();
    int indexId = results.getColumnIndex(PhoneLookup._ID);
    int indexName = results.getColumnIndex(PhoneLookup.DISPLAY_NAME);
    int indexType = results.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE);
    int indexLabel = results.getColumnIndex(ContactsContract.CommonDataKinds.Phone.LABEL);
    int indexNumber = results.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
    while (results.moveToNext()) {
        int type = results.getInt(indexType);
        String custom = results.getString(indexLabel);
        final Contact phoneContact = new Contact(
                results.getString(indexId),
                results.getString(indexName),
                results.getString(indexNumber),
                (String) Phone.getTypeLabel(this.activity.getResources(), type, custom)
        );
        phoneContacts.add(phoneContact);
    }
    results.close();
    return phoneContacts;
}
 
开发者ID:yeriomin,项目名称:DumbphoneAssistant,代码行数:45,代码来源:PhoneUtilEclair.java

示例4: getTypeLabel

import android.provider.ContactsContract.CommonDataKinds.Phone; //导入方法依赖的package包/类
@Override
public CharSequence getTypeLabel(Resources res, int type, CharSequence label) {
    return Phone.getTypeLabel(res, type, label);
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:5,代码来源:Queries.java

示例5: phoneTypeToString

import android.provider.ContactsContract.CommonDataKinds.Phone; //导入方法依赖的package包/类
public CharSequence phoneTypeToString(Context mContext, int type, CharSequence label) {
    return Phone.getTypeLabel(mContext.getResources(), type, label);
}
 
开发者ID:Securecom,项目名称:Securecom-Messaging,代码行数:4,代码来源:ContactAccessor.java

示例6: getTypeLabel

import android.provider.ContactsContract.CommonDataKinds.Phone; //导入方法依赖的package包/类
@Override
public CharSequence getTypeLabel(final Resources res,final int type,final CharSequence label)
  {
  return Phone.getTypeLabel(res,type,label);
  }
 
开发者ID:AndroidDeveloperLB,项目名称:ChipsLibrary,代码行数:6,代码来源:Queries.java


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