Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 861637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:00:35+00:00 2026-05-15T09:00:35+00:00

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

  • 0

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("<spGetOnlinePeoples><UserID>"+GetCurrentUserID.id+"</UserID></spGetOnlinePeoples>"));

                 /* 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>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 && 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<String> adapter2 = new ArrayAdapter<String>(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<?> 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<?> arg0) {

                        }

                }); 

            } catch (Exception e1) {
                e1.printStackTrace();
            }

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:00:36+00:00Added an answer on May 15, 2026 at 9:00 am

    Sounds like you are trying to do your request on the main UI thread. Because the web request takes time the UI thread has to wait until its finished before it can update the screen.

    You should use an AsyncTask to do this request in the background:

    class WebRequestTask extends AsyncTask<String, int[], String[]> {
    
     @Override
     protected String[] doInBackground(String... params) {
       String[] results = null;
    
       // Anything done here is in a seperate thread to the UI thread 
       // Do you download from here
    
       // If you want to update the progress you can call
       publishProgress(int progress); // This passes to the onProgressUpdate method
    
       return results; // This passes the result to the onPostExecute method
     }
    
     @Override
     protected void onProgressUpdate(Integer... progress) {
       // This is on your UI thread, useful if you have a progressbar in your view
     }
    
     @Override
     protected void onPostExecute(String[] results) {
        super.onPostExecute(results);
        // This is back on your UI thread - 
      }
    }
    

    Start your AsyncTask with

    new WebRequestTask().execute();
    

    Have a look at http://developer.android.com/reference/android/os/AsyncTask.html for more info

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 465k
  • Answers 465k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use move_uploaded_file() to move the file to a temporary location;… May 16, 2026 at 1:17 am
  • Editorial Team
    Editorial Team added an answer I never found the "right" way to do this in… May 16, 2026 at 1:17 am
  • Editorial Team
    Editorial Team added an answer To get an icon, you need to provide a BeanInfo… May 16, 2026 at 1:17 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.