Spinner onitemselected listner issue
<p>Im try to create a spinner dynamically on press of a button.</p>

<p>this is what i did:</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.leave_balance);

spinner = new Spinner(this);
    ArrayAdapter&lt;String&gt; spinnerArrayAdapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_spinner_dropdown_item, list);
    spinner.setAdapter(spinnerArrayAdapter);

Button  b = (Button)findviewbyid(R.id.button1);
b.setonclicklistener(new Onclicklistener){
   public void onClick(View v) {
            spinner.performClick();


        }
 spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                int arg2, long arg3) {
            Toast.maketext(context,"selectedspinner",Toast.LENGTH_SHORT).show();

        }

        public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
            // TODO Auto-generated method stub

        }
    });
}
}
</code></pre>

<p>My issue is im not able to get that toast, ie the spinners onitemselectedlistner is not triggering.</p>

<p>Any suggestion will be greatly appreciated.. Thanks </p>
