ProgressDialog with Soap method
<p>Here I am trying to <code>display progressbar when Calling Soap service and dismiss progressbar when response came from service, but progressbar does not appear</code>. It submits data directly and when i tried to do force application, it crashes...</p>

<p>I want to display progress bar as soon as soap method starts and dismiss when it gets over...</p>

<p>Please tell me what to do ???</p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.register);

    Button btnEnter = (Button) findViewById(R.id.btRegister);
    btnEnter.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {

            if (Name.equals("")) {
                textValidation.setText("Please Enter Your Name.");
            } else if (Number.equals("")) {
                textValidation.setText("Please Enter Your Contact Number.");
            } else {
                textValidation.setText("");

                ProgressDialog dialog = ProgressDialog.show(Register.this,
                        "", "Loading. Please wait...", true);

                request = new SoapObject(NAMESPACE, METHOD_NAME);

                name = new PropertyInfo();
                name.setName("Name");
                name.setValue(Name);
                name.setType(String.class);
                request.addProperty(name);

                number = new PropertyInfo();
                number.setName("Number");
                number.setValue(Number);
                number.setType(String.class);
                request.addProperty(number);

                SoapSerializationEnvelope envp = new SoapSerializationEnvelope(
                        SoapEnvelope.VER11);
                envp.dotNet = true;
                envp.setOutputSoapObject(request);
                HttpTransportSE androidHttpTransport = new HttpTransportSE(
                        URL);
                try {
                    androidHttpTransport.call(SOAP_ACTION, envp);
                    SoapPrimitive response = (SoapPrimitive) envp
                            .getResponse();
                    Response = response.toString();

                    if (Response.equals("Success")) {
                        etName.setText("");
                        etEmail.setText("");
                        etNumber.setText("");
                        imageView.setTag("");

                        CookieManager cm = CookieManager.getInstance();
                        cm.setAcceptCookie(true);
                        cm.setCookie("http://192.168.2.9",
                                "MytestbuddyApp=" + Course);
                        CookieSyncManager.getInstance().sync();

                        Intent openStartingPoint = new Intent(
                                "com.MobileWeb.mytestbuddy.Main");
                        startActivity(openStartingPoint);
                    } else {
                        textValidation.setText("Something is Wrong.");
                    }

                } catch (Exception e) {
                    textValidation.setText(e.toString());
                }
                dialog.dismiss();
            }
        }

    });
</code></pre>
