Spinner not displayed
<p>This is the function ,I am trying to use the spinner , data getting from the API but the issue is that the spinner drop down not display.I am new to android.I attached the code below.Please suggest me solution. There is no any error in the code.I print the array i get the data.Only problem is that the drop down not display. When i click on the button response getting.      </p>

<pre><code>        @Override
                public void onClick(View v) 
                {
                    String access=op.getUrl(getApplicationContext(),"ticket","update_properties","");
                    JSONArray access_denied = null;
                    try 
                    {
                        access_denied = new editProperties(access).execute().get();

                    String access_result =access_denied.toString();
                    if(access_result.equals("[\"Accessdenied\"]"))
                    {
                        Operation.showToast(getApplicationContext(), R.string.access);
                    }
                    else
                    {
                        //Log.d("In the else Condition : ","Success");      
                        String DEPT_URL=op.getUrl(getApplicationContext(),"ticket","get_department","&amp;vis_all_department=1");

                        final String dept=tv_dept.getText().toString();
                        filter_dept_id=tv_dept_id.getText().toString(); 

                        if(v.getId()==R.id.td_tv_dept)
                        {       
                            ArrayAdapter&lt;String&gt; dept_Adapter=op.get_dept_adapter(DEPT_URL,DEPARTMENT,Ticket_properties.this,domain_id);

                            final ArrayAdapter&lt;String&gt; dept_id_Adapter=op.get_dept_adapter(DEPT_URL,DEPARTMENT_ID,Ticket_properties.this,domain_id);

                            spin.setAdapter(dept_Adapter);

                            final int dept_Position = dept_Adapter.getPosition(dept);



                            spin.setSelection(dept_Position);//THIS ONE
                            spin.performClick();        

                            spin.setOnItemSelectedListener(new OnItemSelectedListener() {
                                @Override
                                public void onItemSelected(AdapterView&lt;?&gt; parent, View view,
                                    int pos, long id) {   
                                    // TODO Auto-generated method stub
                                    String selected_item=parent.getItemAtPosition(pos).toString();
                                    String selected_item_id=dept_id_Adapter.getItem(pos).toString();

                                    String filter="&amp;vis_ticket_id="+Ticket_id+"&amp;vis_action=department&amp;vis_update_id="+selected_item_id;
                                    String UPDATE_DEPT_URL=op.getUrl(getApplicationContext(),"ticket","update_properties",filter);

                                    JSONArray dept_array;
                                    try 
                                    {
                                        dept_array = new editProperties(UPDATE_DEPT_URL).execute().get();
                                        String result =dept_array.toString();                       

                                        if(result.equals("[\"success\"]"))
                                        {       
                                            tv_dept.setText(selected_item);
                                            tv_dept_id.setText(selected_item_id);           
                                        }
                                        else {Operation.showToast(getApplicationContext(), R.string.error);}
                                    } catch (InterruptedException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();


                                    } catch (ExecutionException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();

                                    }
                                }
                                @Override
                                public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
                                    // TODO Auto-generated method stub  
                                    spin.setSelection(dept_Position);

                                }
                            });     
                        }
                        else if
                        {
                            //NEXT CODE
                        }
</code></pre>

<p>//**********************************************************************</p>

<pre><code>            public ArrayAdapter&lt;String&gt; get_dept_adapter(String URL, String ITEM, Activity context,String domain_id) 
                {
                    // TODO Auto-generated method stub                      
                    JSONArray array ;
                    List&lt;String&gt; item_list = new ArrayList&lt;String&gt;();
                    try {
                        array=new adapter(URL+"&amp;vis_encode=json",context).execute().get();

                        for (int i = 0; i &lt;array.length(); i++) 
                        {           
                            JSONObject object;
                            try {
                                object = array.getJSONObject(i);            
                                String new_domain_id=object.getString("domain_id");
                                if(domain_id.equals(new_domain_id))
                                {
                                    String item=object.getString(ITEM);
                                    item_list.add(item);    
                                }
                            } catch (JSONException e1) {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                            }
                        }

                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();

                    } catch (ExecutionException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();

                    }

                    ArrayAdapter&lt;String&gt; item_Adapter = new ArrayAdapter&lt;String&gt;(context, android.R.layout.simple_spinner_item,item_list);
                    item_Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

                    return item_Adapter;
                }
</code></pre>

<p>//***********************************************************</p>

<pre><code>            Hello i just added the android:spinnerMode="dialog"
            style="@android:style/Widget.Spinner.DropDown"  these two lines and working fine.

            Previous
            ==========
            &lt;Spinner
            android:id="@+id/td_spin"
            android:layout_width="0dp"
            android:layout_height="0dp" /&gt;

            After
            =======
            &lt;Spinner
            android:id="@+id/td_spin"
            android:layout_width="0dp"
            android:layout_height="0dp" 
            android:spinnerMode="dialog"
            style="@android:style/Widget.Spinner.DropDown"
            /&gt;
</code></pre>