@Override public View getView(int position, View convertView, ViewGroup parent) { View view = super.getView(position, convertView, parent); PhoneItem item = getItem(position); ContactsSource source = mSources.getInflatedSource(item.accountType, ContactsSource.LEVEL_SUMMARY); // Obtain a string representation of the phone type specific to the // ContactSource associated with that phone number TextView typeView = (TextView) view.findViewById(android.R.id.text1); DataKind kind = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE); if (kind != null) { ContentValues values = new ContentValues(); values.put(Phone.TYPE, item.type); values.put(Phone.LABEL, item.label); StringInflater header = sendSms ? kind.actionAltHeader : kind.actionHeader; typeView.setText(header.inflateUsing(getContext(), values)); } else { typeView.setText(R.string.call_other); } return view; }
public PhonesAdapter(Context context, List<PhoneItem> objects, boolean sendSms) { super(context, R.layout.phone_disambig_item, android.R.id.text2, objects); this.sendSms = sendSms; mSources = Sources.getInstance(context); }