0
您好所有具有两个在列表视图的按钮。当我点击拒绝按钮时,Alertdialog会到来,在那里我必须输入原因。在输入原因后点击OK按钮,AlertDialog应该关闭。
每一件事都保存到DB ..但警报对话框不关闭......而是输入三次后关闭..我已经在下面写了我的代码。
btnReject.Click += delegate
{
var currentItem = item;
Console.WriteLine(position);
AlertDialog.Builder alert = new AlertDialog.Builder(this.context);
LayoutInflater inflater = Application.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater;
View viewdialog = inflater.Inflate(Resource.Layout.RejectJobsAlertDialog, null);
EditText getreason = viewdialog.FindViewById<EditText>(Resource.Id.Reason);
alert.SetTitle("Reject Reason ");
alert.SetView(viewdialog);
alert.SetPositiveButton("Ok", (senderAlert, args) =>
{
item.RejectedReason = getreason.Text;
sharedasproxy.MobileJobdetailsUpdate(item, BASE_URL + "/xxxxx");
Toast.MakeText(this.context, "success!", ToastLength.Short).Show();
btnReject.Visibility = ViewStates.Invisible;
btnAccept.Visibility = ViewStates.Visible;
dialog.Cancel();
});
alert.SetNegativeButton("Cancel", (senderAlert, args) =>
{
Toast.MakeText(this.context, "Cancelled!", ToastLength.Short).Show();
CloseDialog();
});
dialog = alert.Create();
dialog.Show();
};
非常感谢它为我工作。 –