title: Unable to get custom spinner in android
body: <p>I have followed this <a href="https://stackoverflow.com/questions/11737500/show-dropdown-programatically-in-actionbar-actionbarsherlock">link</a> to learn about implementing custom spinner. My requirement is just to get drop down menu on clicking a image, it should be like a drop down menu where in i load contents to the list from backend.</p>
  
  <p>But i thought that sample example posted in the above link would work. but its not giving any list on clicking a image icon.</p>
  
  <p>Here is the full source code.</p>
  
  <pre><code>package com.example.testdroid;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import android.content.Context;
  import android.os.Bundle;
  import android.view.Gravity;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.ViewGroup.LayoutParams;
  import android.widget.ArrayAdapter;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  import com.actionbarsherlock.app.ActionBar;
  import com.actionbarsherlock.app.SherlockActivity;
  import com.actionbarsherlock.internal.widget.IcsSpinner;
  import com.actionbarsherlock.view.ActionMode;
  import com.actionbarsherlock.view.ActionMode.Callback;
  
  public class MainActivity extends SherlockActivity {
  
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          createCustomActionBar();
      }
  
  //  @Override
  //  public boolean onCreateOptionsMenu(Menu menu) {
  //      // Inflate the menu; this adds items to the action bar if it is present.
  //      getMenuInflater().inflate(R.menu.activity_main, menu);
  //      return true;
  //  }
  
      private void createCustomActionBar() 
      {
          List&lt;String&gt; links = new ArrayList&lt;String&gt;();
          links.add("Abc");
          links.add("Def");
          links.add("Ghi");
          LinksAdapter linkAdapter = new LinksAdapter(this, R.layout.externallink, links);
  
          View customNav = LayoutInflater.from(this).inflate(R.layout.custom_show_action_bar, null);
          IcsSpinner spinner = (IcsSpinner)customNav.findViewById(R.id.spinner);
          spinner.setAdapter(linkAdapter);
  
  
          ImageView refresh = (ImageView) customNav.findViewById(R.id.refresh);
          refresh.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
              }
          });
  
          ImageView settings = (ImageView) customNav.findViewById(R.id.settings);
          settings.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
              }
          });
  
          getSupportActionBar().setCustomView(customNav, new ActionBar.LayoutParams(Gravity.RIGHT));
          getSupportActionBar().setDisplayShowCustomEnabled(true);
  
      }
  
      private static class LinksAdapter extends ArrayAdapter&lt;String&gt; {
  
          private List&lt;String&gt; strings;
          private Context context;
  
          private LinksAdapter(Context mainActivity, int textViewResourceId, List&lt;String&gt; objects) {
              super(mainActivity, textViewResourceId, objects);
              this.strings = objects;
              this.context = mainActivity;
          }
  
          @Override
          public int getCount() {
              if (strings == null) return 0;
              return strings.size();
          }
  
          @Override
          public String getItem(int position) {
              return super.getItem(position);
          }
  
  
          // return views of drop down items
          @Override
          public View getDropDownView(int position, View convertView, ViewGroup parent) {
  
              final String siteLink = strings.get(position);
              LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              // at 0 position show only icon
  
              TextView site = (TextView) inflater.inflate(R.layout.externallink, null);
              site.setText(siteLink);
  
              site.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
                      //Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(siteLink.getUrl()));
                      //context.startActivity(i);
                  }
              });
              return site;
  
  
          }
  
  
          // return header view of drop down
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
              LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              return inflater.inflate(R.layout.custom_show_action_bar, null);
          }
      }
  
  
  }
  </code></pre>
  
  <p>Here is my XML file, i.e layout xml file.</p>
  
  <p><strong>custom_show_action_bar.xml</strong></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                 android:gravity="right"
          &gt;
  
  
      &lt;com.actionbarsherlock.internal.widget.IcsSpinner
          android:id="@+id/spinner"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:paddingRight="20dp"
          android:layout_gravity="center"
              /&gt;
  
       &lt;ImageView  android:layout_width="fill_parent"
                   android:layout_height="fill_parent"
                   android:src="@drawable/ic_launcher"
                   android:paddingRight="20dp"
                   android:paddingLeft="10dp"
                   android:layout_gravity="center"
                   android:background="#ffffff"
                   android:id="@+id/refresh"/&gt;
  
  
      &lt;ImageView  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:src="@drawable/ic_launcher"
                  android:paddingRight="20dp"
                  android:background="#ffffff"
                  android:layout_gravity="center"
                  android:id="@+id/settings"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>External_links.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;TextView 
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
          /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Guide me where i'm wrong.</p>