I've implemented this dialog into my android app and it works fine. How to make a "do not ask me again" dialog pop-up box? Android
That is my onResume() method:
@Override
protected void onResume()
{
AlertDialog.Builder adb = new AlertDialog.Builder(this);
LayoutInflater adbInflater = LayoutInflater.from(this);
View eulaLayout = adbInflater.inflate(R.layout.checkbox, null);
dontShowAgain = (CheckBox) eulaLayout.findViewById(R.id.skip);
adb.setView(eulaLayout);
adb.setTitle("Info");
adb.setMessage(Html.fromHtml("Readme"));
adb.setPositiveButton("Ok", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
String checkBoxResult = "NOT checked";
if (dontShowAgain.isChecked())
checkBoxResult = "checked";
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("skipMessage", checkBoxResult);
editor.commit();
return;
}
});
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
String skipMessage = settings.getString("skipMessage", "NOT checked");
if (!skipMessage.equals("checked"))
adb.show();
super.onResume();
}
But how can I integrate a 10 second countdown into the the OK button. During this countdown the AlertDialog should not be close by clicking the OK button (it should be disabled for the time of the countdown).