Questions tagged «android-alertdialog»

Dialog的子类,可以显示一个,两个或三个按钮。如果只想在此对话框中显示String,请使用setMessage()方法。

3
可以用lambda代替侦听器是什么意思?
我已经实现了AlertDialog带有正常的否定和肯定按钮单击侦听器的。 当我打电话new DialogInterface.OnClickListener()是向我演示了一个建议的说法:Anonymous new DialogInterface.OnClickListener() can be replaced with lambda。我知道这不是错误或重大错误,但是这建议到底是什么,我该怎么办? AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setPositiveButton("Text", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // do something here } }); Android Studio V1.2.1.1 compileSdkVersion 22 buildToolsVersion "22.0.0" minSdkVersion 14 targetSdkVersion 22
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.