title: Custom Spinner Adapter
body: <p>I wanted to apply a custom font to my spinner. The only way i found out is that to create a custom adapter. Here is my code</p>
  
  <pre><code>    private class CustomAdapter extends ArrayAdapter {
  
      private Context context;
      private List&lt;CharSequence&gt; itemList;
      public CustomAdapter(Context context, int textViewResourceId,List&lt;CharSequence&gt; itemList) {
  
          super(context, textViewResourceId);
          this.context=context;
          this.itemList=itemList;
      }
  
      public TextView getView(int position, View convertView, ViewGroup parent) {
  
          TextView v = (TextView) super
                  .getView(position, convertView, parent);
          Typeface myTypeFace = Typeface.createFromAsset(context.getAssets(),
                  "fonts/gilsanslight.otf");
          v.setTypeface(myTypeFace);
          v.setText(itemList.get(position));
          return v;
      }
  
      public TextView getDropDownView(int position, View convertView,
              ViewGroup parent) {
  
          TextView v = (TextView) super
                  .getView(position, convertView, parent);
          Typeface myTypeFace = Typeface.createFromAsset(context.getAssets(),
                  "fonts/gilsanslight.otf");
          v.setTypeface(myTypeFace);
          v.setText(itemList.get(position));
          return v;
      }
  
  }
  </code></pre>
  
  <p>Then i use </p>
  
  <pre><code>List&lt;CharSequence&gt; itemList = new ArrayList&lt;CharSequence&gt;(
              Arrays.asList(items));
  
      mySpinnerArrayAdapter = new   CustomAdapter(context,android.R.layout.simple_spinner_item,itemList); 
      spinner.setAdapter(mySpinnerArrayAdapter);
  </code></pre>
  
  <p>After doing this, my adapter is empty. Can anyone please help me ? The items contains a list of countries. </p>
  
  <p>Kind Regards,</p>