关闭活动一下在android的警告对话框正面按钮后, [英] Closing the activity after clicking positive button in alert dialog in android

查看:104
本文介绍了关闭活动一下在android的警告对话框正面按钮后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有活动称为A,这显示items.On点击更新按钮列表则显示自定义对话框(活动显示,在背面)与被点击自定义对话框内selected.When Order按钮的项目列表。

i have activity called "A" which displays the list of items.On clicking update button it shows the custom dialog (activity is showed in the back)with the list of items selected.When Order button inside custom dialog is clicked .

  1. 在自定义对话框消失。
  2. 在进度对话框显示(因为为了工作是怎么回事)
  3. 则进度对话框是为了工作完成后关闭
  4. 我会显示警告对话框说订购确认
  5. 当我单击提示对话框的积极按钮,我想关闭该活动在后面这(即活性A)。想移动到主屏幕
  6. 如何调用alertdialog正面按钮内部的光洁度code Onclicklistener()

请帮我解决这个问题。

noData.setPositiveButton("Ok", new DialogInterface.OnClickListener(){
    @Override
    public void onClick(DialogInterface dialog, int which) {
        dialog.cancel();
    }
});

我怎么能取消后添加完成()的alertDialog()

How can i add the finish() after cancelling the alertDialog()

推荐答案

您需要是这样的:

noData.setPositiveButton("Ok",
    new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Finish activity
            finish();
        }
    });

刚加入的onClick内完成()应该做的伎俩。

Just adding finish() inside the onClick should do the trick.

这篇关于关闭活动一下在android的警告对话框正面按钮后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆