tencent cloud

Tencent Cloud Super App as a Service

Generic Dialog

Download
Focus Mode
Font Size
Last updated: 2025-07-04 17:33:27
Note:
The SDK includes various scenarios for displaying dialogs, such as the camera and photo selection dialogs in the media selection feature, as well as calling wx.showModal in mini programs. The superapp can customize dialog styles by overriding theAbsMiniUiProxy.showCommonDialog API.
DialogInfo: This includes basic information about the dialog, such as the title, description, and event listeners, allowing developers to create dialogs based on this information.
/**
* Generic dialog display API
* @param context - Dialog context
* @param dialogInfo - Dialog information
* @return true indicates using a custom dialog, false indicates using the SDK default dialog
*/
boolean showCommonDialog(Activity context, DialogInfo dialogInfo);
Example:
@Override
public boolean showCommonDialog(Activity context, DialogInfo dialogInfo) {
AlertDialog dialog = new AlertDialog.Builder(context)
.create();
dialog.setTitle(dialogInfo.getTitle());
dialog.setMessage(dialogInfo.getMessage());

if (dialogInfo.getPositiveButtonText() != null) {
dialog.setButton(DialogInterface.BUTTON_POSITIVE, dialogInfo.getPositiveButtonText(), dialogInfo.getPositiveButtonListener());
}
if (dialogInfo.getNegativeButtonText() != null) {
dialog.setButton(DialogInterface.BUTTON_NEGATIVE, dialogInfo.getNegativeButtonText(), dialogInfo.getNegativeButtonListener());
}
dialog.setCancelable(dialogInfo.isCancelable());
dialog.setOnCancelListener(dialogInfo.getCancelListener());
dialog.setOnDismissListener(dialogInfo.getDismissListener());
dialog.show();
return true;
}



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback