@ Override public View getDropDownView ( int position , View convertView , ViewGroup parent ) { final ViewHolder viewHolder ; if ( convertView == null ) { convertView = mLayoutInflater . inflate ( R . layout . item_country , parent , false ) ; viewHolder = new ViewHolder ( ) ; viewHolder . mImageView = ( ImageView ) convertView . findViewById ( R . id . intl_phone_edit__country__item_image ) ; viewHolder . mNameView = ( TextView ) convertView . findViewById ( R . id . intl_phone_edit__country__item_name ) ; viewHolder . mDialCode = ( TextView ) convertView . findViewById ( R . id . intl_phone_edit__country__item_dialcode ) ; convertView . setTag ( viewHolder ) ; } else { viewHolder = ( ViewHolder ) convertView . getTag ( ) ; } Country country = getItem ( position ) ; viewHolder . mImageView . setImageResource ( getFlagResource ( country ) ) ; viewHolder . mNameView . setText ( country . getName ( ) ) ; viewHolder . mDialCode . setText ( String . format ( "+%s" , country . getDialCode ( ) ) ) ; return convertView ; }
Drop down item view