我在Eclipse Android项目中使用了这段代码
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
Run Code Online (Sandbox Code Playgroud)
但Eclipse说:
此方法在API级别3中已弃用.对BUTTON_POSITIVE使用setButton(int,CharSequence,android.content.DialogInterface.OnClickListener)
Opr*_*day 19
AlertDialog alert = new AlertDialog.Builder(this).create();
alert.setTitle("Error");
alert.setMessage("Sorry, your device doesn't support flash light!");
alert.setButton(Dialog.BUTTON_POSITIVE,"OK",new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
alert.show();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15691 次 |
| 最近记录: |