首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

AlertDialog等待用户操作解决方法

2012-04-23 
AlertDialog等待用户操作怎么才能让用户点击了AlertDialog弹出框的某个按钮才继续运行而不是在弹出框存在

AlertDialog等待用户操作
怎么才能让用户点击了AlertDialog弹出框的某个按钮才继续运行
而不是在弹出框存在的情况下运行后面的函数

[解决办法]
后面的函数放在按钮事件监听里。
[解决办法]
将后面的函数放到Onclick的事件处理中
[解决办法]
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ShoppingShow.this);
alertDialog.setTitle("").setMessage("AlertDialog").setPositiveButton("是", new android.content.DialogInterface.OnClickListener(){

public void onClick(DialogInterface dialog, int which) {

// TODO Auto-generated method stub
//点击“是”后想干的事情加进来

}}).setNegativeButton("否", new android.content.DialogInterface.OnClickListener(){



public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
//点击“是”后想干的事情加进来
}}).create().show();

[解决办法]
setNegativeButton("按钮文字",点击事件(){
//你想这里干啥都行!!!!!!!!
})

热点排行