black screen while retrieving result from webservices in android
<pre><code>Hi Folks 

i am using following webservices for retrieving data from server 
server side:.net 
client side:ksoap2

whenever activity start, onCreate i am using spinner for displying data returned by the webservices
when this activity start it showing black screen after lunching the activity .i found black screen is coming when activity connecting to webservices

How to resolve this 


MyCode

public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
 try {
                 //Display the online and busy people display in spinner 
                 //people are display in relative people only(Mygroup)
                 /* get the online and busy people who are in user group from DB*/
                 users_names_ids=new ParseXMLString().convertusernames(new DataParsingComm().ILGetOnlinePeoples("&lt;spGetOnlinePeoples&gt;&lt;UserID&gt;"+GetCurrentUserID.id+"&lt;/UserID&gt;&lt;/spGetOnlinePeoples&gt;"));

                 /* create an array with the size of number of peoples whose status is online or busy */
                 String[] array =new String[users_names_ids.size()];        
                 int setselction=0;// initialize the selection to 0.

                 /* if array length is greater than zero, that means getting at least one person whose status is online or busy */
                 if(array.length&gt;0){

                     /* Returns an enumeration on the keys of this Hashtable instance. And assigns into Enumeration instance variable */
                     Enumeration e= users_names_ids.keys(); 

                     /* Iterate list Enumeration until it does't has any more elements */
                     for(int i=0;e.hasMoreElements();i++)
                         try{
                             /* get all persons names into the array list */
                             array[i]=e.nextElement().toString();

                             /* Get the ChatUserName value from the ChatInPeopleDetails preferences. And If it is in this list set selection to the index 'i' */
                             if(getSharedPreferences("ChatInPeopleDetails", 0).getString("ChatUserName", "").equals(array[i]))
                                 setselction=i;

                                /* 
                                 * Get the String value of Relname, that previously added with putExtra() as extended data to the parent intent
                                 * If that value is not null and exists in the array list then
                                 * set the selection to the index 'i'.
                                 *   */
                             else if(getIntent().getStringExtra("Relname")!=null &amp;&amp; getIntent().getStringExtra("Relname").equals(array[i]))
                                      setselction=i;

                         }catch(Exception ex){
                             ex.printStackTrace();
                         }
                         finally
                         {
                             System.gc();
                             System.runFinalization();
                         }
                 }

                 /* create a new array adapter with the ChatForm context and array objects  */
                ArrayAdapter&lt;String&gt; adapter2 = new ArrayAdapter&lt;String&gt;(ChatForm.this,android.R.layout.simple_spinner_item, array);

                /* Set the layout resource to create the drop down views. */
                adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

                /*  The Adapter is used to provide the data which backs this Spinner SpinnerUsersToChat. */
                ((Spinner)findViewById(R.id.SpinnerUsersToChat)).setAdapter(adapter2);

                /*  Get the ChatUserName value from the ChatInPeopleDetails preferences. If this value  is not null*/
                if(getSharedPreferences("ChatInPeopleDetails", 0).getString("ChatUserName", "") !=null)
                {
                    /* Set the currently selected item  of spinner based on selection variable value  */
                     ((Spinner)findViewById(R.id.SpinnerUsersToChat)).setSelection(setselction);
                }

                /* Register a callback to be invoked when an item in this AdapterView has been selected.*/
                ((Spinner)findViewById(R.id.SpinnerUsersToChat)).setOnItemSelectedListener(new OnItemSelectedListener()
                {
                    public void onItemSelected(AdapterView&lt;?&gt; parent,View v,int position,long id)
                        {                   
                            /* call getMsg() to get messages and  display them*/
                             getMsg();
                             /* Causes the Runnable to be added to the message queue. The runnable will be run on the user interface thread.*/
                             ((ScrollView)findViewById(R.id.ScrollView06)).post(new Runnable()
                              { 
                               public void run() 
                               { 
                                   /* This fullScroll() method will scroll the view to the bottom .*/
                                   ((ScrollView)findViewById(R.id.ScrollView06)).fullScroll(View.FOCUS_DOWN); 
                                } 

                            });
                        }
                        /* on nothing selected to do somthing . this an overridden method */
                        public void onNothingSelected(AdapterView&lt;?&gt; arg0) {

                        }

                }); 

            } catch (Exception e1) {
                e1.printStackTrace();
            }
</code></pre>

<p>}</p>
