convert Contact Number Type - Android Account

Android examples for Account:Contact Number

Description

convert Contact Number Type

Demo Code


//package com.java2s;

import android.provider.ContactsContract;

public class Main {
    public static String convertNumberType(int id, String label) {
        switch (id) {
        case ContactsContract.CommonDataKinds.Phone.TYPE_ASSISTANT:
            return "Assistant";
        case ContactsContract.CommonDataKinds.Phone.TYPE_CALLBACK:
            return "Callback";
        case ContactsContract.CommonDataKinds.Phone.TYPE_CAR:
            return "Car";
        case ContactsContract.CommonDataKinds.Phone.TYPE_COMPANY_MAIN:
            return "Company";
        case ContactsContract.CommonDataKinds.Phone.TYPE_FAX_HOME:
            return "Fax Home";
        case ContactsContract.CommonDataKinds.Phone.TYPE_FAX_WORK:
            return "Fax Work";
        case ContactsContract.CommonDataKinds.Phone.TYPE_HOME:
            return "Home";
        case ContactsContract.CommonDataKinds.Phone.TYPE_ISDN:
            return "ISDN";
        case ContactsContract.CommonDataKinds.Phone.TYPE_MAIN:
            return "Main";
        case ContactsContract.CommonDataKinds.Phone.TYPE_MMS:
            return "MMS";
        case ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE:
            return "Mobile";
        case ContactsContract.CommonDataKinds.Phone.TYPE_OTHER_FAX:
            return "Other fax";
        case ContactsContract.CommonDataKinds.Phone.TYPE_PAGER:
            return "Pager";
        case ContactsContract.CommonDataKinds.Phone.TYPE_RADIO:
            return "Radio";
        case ContactsContract.CommonDataKinds.Phone.TYPE_TELEX:
            return "Telex";
        case ContactsContract.CommonDataKinds.Phone.TYPE_TTY_TDD:
            return "TTY TDD";
        case ContactsContract.CommonDataKinds.Phone.TYPE_WORK:
            return "Work";
        case ContactsContract.CommonDataKinds.Phone.TYPE_WORK_MOBILE:
            return "Work Mobile";
        case ContactsContract.CommonDataKinds.Phone.TYPE_WORK_PAGER:
            return "Work Pager";
        case ContactsContract.CommonDataKinds.Phone.TYPE_CUSTOM:
            return label == null ? "Other" : label;
        }/*from   ww  w  .  j a  v  a2  s  .c om*/

        return "Other";
    }
}

Related Tutorials