我正在尝试在弹出窗口中设置 textview,并且进入 textview PopUp 的字符串来自 SOAP Web 服务调用。我在 logCat 中看到了字符串消息,并且弹出了 PopUp,但由于某种原因,我无法设置 textview 来显示我的消息。我错过了什么。
感谢您。
public void wtfPopUp()
{
//
String PopYesNo;
String PopMsgAll = null;
//
////////////////////////FIRST CALL FOR YES-NO POP Status BEGIN
SoapObject Request = new SoapObject(NAMESPACEPopYesNo, METHOD_NAMEPopYesNo);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
HttpTransportSE ahtt = new HttpTransportSE(URLPopYesNo);
//////////////////////// SECOND CALL FOR POP MESSAGE BEGIN
SoapObject Request2 = new SoapObject(NAMESPACEAllPop, METHOD_NAMEAllPop);
// Request.addProperty("c_idid", "1");
SoapSerializationEnvelope soapEnvelope2 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope2.dotNet = true;
soapEnvelope2.setOutputSoapObject(Request2);
HttpTransportSE ahtt2 = new HttpTransportSE(URLAllPop);
//////////////////////// SECOND CALL FOR MESSAGE END
try
{
Log.d("myAppWtf", "at getPopUpAllTRY");
ahtt.call(SOAP_ACTIONPopYesNo, soapEnvelope);
SoapObject oResponse = (SoapObject)soapEnvelope.bodyIn;
PopYesNo = oResponse.getPropertyAsString(0).toString();
Log.d("myAppYesNo", oResponse.getPropertyAsString(0).toString());
if(PopYesNo.equals("PopUp_ON") )
{
try{
//////////////////////// SECOND CALL FOR MESSAGE BEGIN
ahtt2.call(SOAP_ACTIONAllPop, soapEnvelope2);
SoapObject oResponse2 = (SoapObject)soapEnvelope2.bodyIn;
PopMsgAll = oResponse2.getPropertyAsString(0).toString();
Log.d("myAppMSGGGG", oResponse2.getPropertyAsString(0).toString());
///////////////////////////// SECOND CALL FOR MESSAGE END
}
catch(Exception ms){
ms.printStackTrace();
}
// POP UP CODE
LayoutInflater li = LayoutInflater.from(context);
View promptsView = li.inflate(R.layout.popup_all, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
// set prompts.xml to alertdialog builder
alertDialogBuilder.setView(promptsView);
// set dialog message
alertDialogBuilder
.setCancelable(false)
.setNegativeButton("Cool",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
dialog.cancel();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
// TEXT FOR POP UP MSG
txtViewPop = (TextView)findViewById(R.id.txtMsgAll);
txtViewPop.setText(PopMsgAll.toString());
// txtViewPop.setTextColor(Color.rgb(2, 39, 72));
}
}
catch(Exception ix)
{
ix.printStackTrace();
}
}