本文介绍了Android的意图对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新的Android开发者,所以我需要你的帮助。我在做一个应用程序,其中一个按钮动作打开一个对话框。对话框中有一个按钮。我可以一心想按钮操作?请给一些好的可能的方式。谢谢
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的意图对话框
发布评论