有没有办法让警报只在应用程序打开时出现?我在 MainActivity 的 onStart() 中创建了一个警报,每当我回到应用程序中的那个活动时,它都会再次显示警报,这可能会让用户感到烦恼。或者有没有办法创建一个“得到它”按钮然后关闭警报?这是我的代码:
protected void onStart() {
super.onStart();
new AlertDialog.Builder(this)
.setTitle("Instructions")
.setMessage("Hello! To begin, select a map from the list to train with. Make sure" +
" you are on the correct floor.")
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
})
.setIcon(R.drawable.ic_launcher)
.show();
}