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

  • SEARCH
  • Home
  • 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 6343107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:22:16+00:00 2026-05-24T20:22:16+00:00

I have an activity which checks username availability via .net web services, I need

  • 0

I have an activity which checks username availability via .net web services, I need to show a ‘please wait’ message during the call as it can take a second or two – I have experimented with AsyncTask and Threading but the problem I have is I actually want to block the main (and only) thread until the web service call has completed as I am depending on the result from it to process other logic.

I have tried allsorts but no joy – can anyone help please?

As requested, here is a section of my code :

private OnClickListener RegistrationListener = new OnClickListener() {
    public void onClick(View v) {
        ClearFieldHighlighting();
        if (ValidateData()) {
            if (IsOnline()) {
                if (UsernameIsAvailable()) {
                    try {
                        iNETUserID = CreateOnlineUser();
                    } catch (Exception e) {
                    }

..more code..
}

Here is the ‘UsernameIsAvailable’ function :

public boolean UsernameIsAvailable() {

    Boolean bUsernameIsAvailable = false;

    SoapObject request = new SoapObject(TA.sNAMESPACE,
            TA.METHOD_IsUsernameAvailable);
    request.addProperty("sUsername", sEmail);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(
            TA.WEBSERVICES_URL);

    try {
        androidHttpTransport.call(TA.SOAP_ACTION_IsUsernameAvailable,
                envelope);
        SoapObject thisresponse = (SoapObject) envelope.bodyIn;

        for (int i = 0; i < thisresponse.getPropertyCount(); i++) {
            Object obj = thisresponse.getProperty(i);
            SoapPrimitive soapPrimitive = (SoapPrimitive) obj;
            bUsernameIsAvailable = Boolean.parseBoolean(soapPrimitive
                    .toString());
        }
    } catch (Exception e) {
    }

    return bUsernameIsAvailable;
}

I am using KSoap2 which is an external jar file to handle the web service stuff

Thanks
Mike

  • 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-24T20:22:19+00:00Added an answer on May 24, 2026 at 8:22 pm

    You can structure your code in the following way:

    private class MyBackgroundTask extends AsyncTask<Void, Void, Void> {
        protected void onPreExecute() {
            // show dialog
        }
        protected Void doInBackground(Void... unused) {
            // background processing
        }
        protected void onPostExecute(Void unused) {
            // dismiss dialog
            continueProcessing();
        }
    }
    
    private OnClickListener RegistrationListener = new OnClickListener() {
        public void onClick(View v) {
            // non-blocking code
    
            new MyBackgroundTask().execute();
        }
    }
    
    public void continueProcessing() {
        // the rest of the main activity
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one activity which download data from the web. In middle of the
I have an activity which shows some List entries. When I click on a
I have created an activity which sends a number of notifications to status bar.
I have a couple of tables which are used to log user activity for
Say if I have a locationManager(LM) object in activity A, which is my main
I have an Activity, which contains a bunch of check boxes and a submit
this is the current state/situation: I have an Activity which binds a Service which
I have a scenario whereby we need an activity to have a timeout associated
I have a simple activity with only one edittext which was set to http://
I have an activity which is used for editing some object. Currently its layout

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.