title: Spinner onItemSelected doesn't work when i use setAdapter()
body: <p>I have 1 spinner named spinner1. visiblity set to invisible. then i use an image button to perform click to launch spinner. 
  When i give array data from strings.xml. it calls onItemSelected. (static array)
  but when i user arrayadapter to setadapter of spinner. it doesnt fire onItemSelected event.</p>
  
  <p>let me show you some code.</p>
  
  <pre><code>final Spinner catlist = (Spinner) findViewById(R.id.spinner1);
  
  ArrayAdapter&lt;String&gt; spnadp = new ArrayAdapter&lt;String&gt;(getApplicationContext(), R.layout.style1,android.R.id.text1,phone_numbers);
  
  catlist.setAdapter(spnadp);
  catlist.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
  
      @Override
      public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                      int arg2, long arg3) {
              Toast.makeText(getApplicationContext(), "bbname came is ", Toast.LENGTH_LONG).show();
      }
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; arg0) {        
      }
  });
  </code></pre>
  
  <p>and phone_numbers is an ArrayList.</p>
  
  <pre><code>ImageButton bt1 = (ImageButton) findViewById(R.id.imageButton1);
  bt1.setOnClickListener(new View.OnClickListener() {
  
      public void onClick(View v) {
             catlist.performClick();
      }
  });
  </code></pre>
  
  <p>this is how i call that.</p>
  
  <p>so my question is what is wrong with setting adapter.
  if i dont setadapter it works fine . it fire Onitemselected(). and in other case it doesnt.</p>
  
  <p><em><strong>Edited:</em></strong> (style1.xml)</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:id="@android:id/text1"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:minHeight="?android:attr/listPreferredItemHeight"
          android:paddingLeft="6dip"
          android:textColor="@color/maroon"
          android:textStyle="bold"
          android:textSize="8pt"
          android:paddingRight="10dip"
          android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <hr>
  
  <p>@Hiral
  Application force close and i got this...</p>
  
  <pre><code>09-13 14:55:29.319: E/AndroidRuntime(8380): FATAL EXCEPTION: main
  09-13 14:55:29.319: E/AndroidRuntime(8380): java.lang.NullPointerException
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:353)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.AbsListView.obtainView(AbsListView.java:1495)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.ListView.measureHeightOfChildren(ListView.java:1216)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.ListView.onMeasure(ListView.java:1127)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.View.measure(View.java:8335)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.View.measure(View.java:8335)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.View.measure(View.java:8335)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.View.measure(View.java:8335)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.View.measure(View.java:8335)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.ViewRoot.performTraversals(ViewRoot.java:843)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1892)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.os.Handler.dispatchMessage(Handler.java:99)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.os.Looper.loop(Looper.java:130)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at android.app.ActivityThread.main(ActivityThread.java:3835)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at java.lang.reflect.Method.invoke(Method.java:507)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
  09-13 14:55:29.319: E/AndroidRuntime(8380):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>