Android的意图对话框

编程入门 行业动态 更新时间:2024-10-18 01:35:21
本文介绍了Android的意图对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是新的Andr​​oid开发者,所以我需要你的帮助。我在做一个应用程序,其中一个按钮动作打开一个对话框。对话框中有一个按钮。我可以一心想按钮操作?请给一些好的可能的方式。谢谢

I'm new android developer so I need your help. I'm making a app in which a button action open a dialog box. Dialog box has a button. Can i intent on the button action? Kindly give some good possible ways. Thanks

推荐答案

您要处理的确定事件,并执行一些动作。

you want to handle the "Ok" event and perform some action.

您必须处理对话框的方法。

You have a method to handle the dialog.

public void displayAlertToChangeActivity(){ AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("title"); alert.setMessage("massage"); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //Do something here where "ok" clicked and then perform intent from activity context Intent intent = new Intent(MyActivity.this, MyNextActivity.class); MyActivity.this.startActivity(intent); } }); alert.show();

}

更多推荐

Android的意图对话框

本文发布于:2023-11-17 12:35:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1610020.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对话框   意图   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!