ダイアログを作成し、そのダイアログのボタンをクリックして別のダイアログに移動し、新しいダイアログの別のボタンをクリックして前のダイアログに移動する方法はありますか?
Dialog - > Dialog2 -> Dialog
これは私のコードです:
private void showIBW() {
final String[] frame = { "Small", "medium", "large" };
AlertDialog.Builder framechoice = new AlertDialog.Builder(this);
framechoice.setTitle("please choose your frame size");
framechoice.setNeutralButton("what's this?",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
AlertDialog.Builder help = new AlertDialog.Builder(getApplicationContext());
help.setTitle("Frame explanation");
help.setMessage("cheikh is not helpful");
help.setNeutralButton("okay thanks", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
////// Here i want this button to get me back to the "Framechoice" dialog///
}
});
help.create();
help.show();
}
});
framechoice.setItems(frame, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
SharedPreferences customSharedPreference = getSharedPreferences(
"myCustomSharedPrefs", Activity.MODE_PRIVATE);
Toast.makeText(getApplicationContext(), frame[which],
Toast.LENGTH_LONG).show();
String Height = customSharedPreference.getString("heightpref",
null);
float height = Integer.parseInt(Height);
float weight1 = ((height / 100) * (height / 100)) * 20;
float weight2 = ((height / 100) * (height / 100)) * 25;
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(
CalculationsActivity.this);
dialogBuilder.setTitle("Ideal weight calculator");
dialogBuilder
.setMessage("Your ideal weight is between:\n "
+ Math.round(weight1)
+ " Kg to "
+ Math.round(weight2) + " kg");
dialogBuilder.setPositiveButton("ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
Intent u = new Intent();
u.setClass(CalculationsActivity.this,
CalculationsActivity.class);
startActivity(u);
}
}).create();
dialogBuilder.show();
}
}).create();
framechoice.show();
}