我正在开发一个完全基于servlet请求和响应的android应用程序。我已经在自定义警报对话框中填充了一些数据。我使用了两件事——第一件事是交叉按钮,它将从警报对话框的列表中删除项目并更新警报对话框的视图,第二件事是关闭按钮,它可能会关闭这个警报对话框。我正在显示我的警报对话框的完整编码。我通过所有这些方法点击按钮调用警报对话框。
intiliazeOrderListDialog();
showOrderListDialog();
我的心情如下
public AlertDialog detailsDialog, orderDialog;
AlertDialog.Builder builder;
现在我要发布我的intiliazeOrderListDialog()块。
public void intiliazeOrderListDialog() {
builder = new AlertDialog.Builder(MainScreen.this);
mContext = getApplicationContext();
inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
orderDialogLayout = inflater.inflate(R.layout.my_order_list,(ViewGroup)findViewById(R.id.order_list_root));
orderList = (ListView) orderDialogLayout.findViewById(R.id.order_list);
ibOrderDelete = (ImageButton)orderDialogLayout.findViewById(R.id.deleteOrder);
tvPrice = (TextView) orderDialogLayout.findViewById(R.id.order_list_total);
tvTaxes = (TextView) orderDialogLayout.findViewById(R.id.order_list_taxes);
tvTotal = (TextView) orderDialogLayout.findViewById(R.id.order_list_grand_total);
Button bclose = (Button) orderDialogLayout.findViewById(R.id.close);
Button bPlaceOrder = (Button) orderDialogLayout.findViewById(R.id.my_order_placeorder);
bclose.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
orderDialog.dismiss();
System.out.println(" click on closowse");
}
});
bPlaceOrder.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
System.out.println("Place order click");
palceMyOrdertoServer();
new SendOrderFromTable().execute();
System.out.println("place order to server is called");
String msg = "Your Order is Successfully placed to Kitcken";
Message msgObject = new Message();
msgObject.what = 1;
msgObject.obj = msg;
addMenuItemHandler.sendMessage(msgObject);
orderDialog.dismiss();
}
});
}
最后我要发布showOrderListDialog();块
public void showOrderListDialog() {
builder.setView(orderDialogLayout);
orderDialog = builder.create();
orderDialog.show();
}
我知道我发布了太多代码,但这对那些想帮助我的人来说很方便。我有一个很简单的问题
orderDialog.dismiss();
对我不起作用。?提前感谢所有人。