diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index ad9aeb594..408d9c6a6 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -1233,9 +1233,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh /** Result of current messagebox. Also used for blocking the calling thread. */ protected final int[] messageboxSelection = new int[1]; - /** Id of current dialog. */ - protected int dialogs = 0; - /** * This method is called by SDL using JNI. * Shows the messagebox from UI thread and block calling thread. @@ -1279,7 +1276,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh runOnUiThread(new Runnable() { @Override public void run() { - showDialog(dialogs++, args); + messageboxCreateAndShow(args); } }); @@ -1299,8 +1296,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh return messageboxSelection[0]; } - @Override - protected Dialog onCreateDialog(int ignore, Bundle args) { + protected void messageboxCreateAndShow(Bundle args) { // TODO set values from "flags" to messagebox dialog @@ -1329,7 +1325,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // create dialog with title and a listener to wake up calling thread - final Dialog dialog = new Dialog(this); + final AlertDialog dialog = new AlertDialog.Builder(this).create(); dialog.setTitle(args.getString("title")); dialog.setCancelable(false); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @@ -1415,7 +1411,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // add content to dialog and return - dialog.setContentView(content); + dialog.setView(content); dialog.setOnKeyListener(new Dialog.OnKeyListener() { @Override public boolean onKey(DialogInterface d, int keyCode, KeyEvent event) { @@ -1430,7 +1426,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } }); - return dialog; + dialog.show(); } private final Runnable rehideSystemUi = new Runnable() {