如何在AlertDialog
中保存状态,以便在关闭并再次运行后可以保存应用程序状态?
private void CreateView(final Context context) {
// TODO Auto-generated method stub
AlertDialog.Builder builder = new AlertDialog.Builder(AndjeloOne.this);
LayoutInflater inflater = AndjeloOne.this.getLayoutInflater();
View v = inflater.inflate(R.layout.dialog_add, null);
builder.setView(v)
.setPositiveButton("Save", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setTitle("Text Size");
final SeekBar sbBetVal = (SeekBar) v.findViewById(R.id.seekBar1);
final TextView tvBetVal = (TextView) v.findViewById(R.id.tvBetVal);
final TextView t1 = (TextView) findViewById(R.id.textViewNulin);
sbBetVal.setMax(24);
sbBetVal.setProgress(0);
sbBetVal.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
int size = 12;
t1.setTextSize(size + progress);
tvBetVal.setText(String.valueOf(progress));
}
});
builder.create();
builder.show();
}