1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Add alert window on Android

This commit is contained in:
volzhs
2016-11-28 10:20:57 +09:00
parent cefb2de339
commit 9a20068ab7
4 changed files with 38 additions and 5 deletions

View File

@@ -295,6 +295,25 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
});
}
}
public void alert(final String message, final String title) {
runOnUiThread(new Runnable() {
@Override
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(getInstance());
builder.setMessage(message).setTitle(title);
builder.setPositiveButton(
"OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
});
}
private static Godot _self;