我正在尝试从wbservice收到结果后显示一个对话框。 显示Toast工作正常,但不是对话框。怎么了?
progress = ProgressDialog.show(ServiceProperties.this,
"Please wait...", "Saving configuration...");
new Thread(new Runnable() {
public void run() {
String Res = null;
ESMWebService ESMws = new ESMWebService();
try {
ESMws.AddParam("ComputerName", ComputerName);
ESMws.AddParam("ServiceName", ServiceName);
ESMws.AddParam("Properties", Properties);
Res = ESMws.ExecuteMethod("ChangeService");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (Res != null) {
runOnUiThread(new Runnable() {
@Override
public void run() {
new AlertDialog.Builder(serviceActivity.getApplicationContext())
.setTitle("Save")
.setMessage("Saving service configuration succeeded.")
.setNeutralButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int arg) {
serviceActivity.finish();
}
})
.show();
progress.dismiss();
}