Getting Error while creating spinner programmatically
<p>I have a button in my xml. I want to pop up spinner programmatically not from xml after </p>

<p>clicking on button. but when i am clicking on the sbutton it is giving me an error. </p>

<p>Log output-:</p>

<pre><code>android.view.WindoManager

$BadTokenException: Unable to add window--token null is not for an application
</code></pre>

<p>Here is my code:</p>

<pre><code>b1.setOnclickListener(new View.OnClickListener(){
public void onClick(View v) {
List&lt;String&gt; list = new ArrayLIst&lt;String&gt;(Arrays.asList("a","s","d"));
Spinner t = new Spinner(getApplicationContext());
ArrayAdapter&lt;String&gt; adp = new ArrayAdapter&lt;String&gt;   

(getApplicationContext(),android.R.layout.simple_spinner_item,list);
adp.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
t.setAdapter(adp);
t.performClick();
</code></pre>
