ここで私はしようとしていdisplay progressbar when Calling Soap service and dismiss progressbar when response came from service, but progressbar does not appear
ます。データを直接送信し、強制適用しようとするとクラッシュします...
ソープメソッドの起動と同時にプログレスバーを表示し、終わったら閉じるようにしたい...
何をすべきか教えてください???
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();
}
}
});