as i understand your question seem to be fix easily consider this code
1-
alertDialog1.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
toggelBt.toggle();
}
});
2- and on other way u can save your State On runtime in boolean Variable in each calling ToggleButton Onclick method (using sharedPreference instead boolean for saving and using on next app startup) then
Boolean CheckState
...
alertDialog1.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if(checkState)//should set uncheck now
toggelBt.setChecked(false);
else
toggelBt.setChecked(true);
}
});
hop to be usefull :)