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