我如何实现一个preference显示简单的是/否确认对话框?
How can I implement a Preference that displays a simple yes/no confirmation dialog?
有关示例,请参阅浏览器 - >设置 - >清除缓存
这是一个简单的警告对话框< /一>,费德里科给你一个网站,你可以看看的事情了。
That is a simple alert dialog, Federico gave you a site where you can look things up.
下面是如何构建一个警告对话框一个简单的例子。
Here is a short example of how an alert dialog can be built.
new AlertDialog.Builder(this)
.setTitle("Title")
.setMessage("Do you really want to whatever?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Toast.makeText(MainActivity.this, "Yaay", Toast.LENGTH_SHORT).show();
}})
.setNegativeButton(android.R.string.no, null).show();