标签:android blog http java os art
android开发中,点击弹出对话框中的按钮进行页面跳转,如何实现?可以这样做:
可以获取对话框的点击事件,比如点击了确定然后你就跳转
AlertDialog.Builder builder = new Builder(CommentActivity.this); builder.setMessage("确定要跳转吗?"); builder.setTitle("提示"); builder.setPositiveButton("确认", new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { // TODO Auto-generated method stub arg0.dismiss(); 这里跳转到你想要去的页面 } }); builder.setNegativeButton("取消", new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show();
arg0就是该listener的接口啊,通过这个参数就可以关闭对话框。跳到想去的页面就startIntent就好了,你把那一行中文换成
Intent it = new Intent(this,UserActivity.class); startActivity(it);
当然要跳去哪个页面就你自己决定
AlertDialog.Builder builder = new Builder(CommentActivity.this); builder.setMessage("确定要跳转吗?"); builder.setTitle("提示"); builder.setPositiveButton("确认", new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { // TODO Auto-generated method stub arg0.dismiss(); Intent it = new Intent(this,UserActivity.class); startActivity(it); } }); builder.setNegativeButton("取消", new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show();
http://bbs.ibeifeng.com/read-htm-tid-68064.html
android 开发点击弹出对话框中的按钮进行页面跳转如何实现,布布扣,bubuko.com
android 开发点击弹出对话框中的按钮进行页面跳转如何实现
标签:android blog http java os art
原文地址:http://www.cnblogs.com/itmeigui/p/3820175.html