Updated on 2024-07-30 GMT+08:00

Obtaining an Error Message

This API is used to obtain an error message.

Precautions

None

Method Definition

String getErrorMessage(int errCode);

Sample Code

public static void showToast(String apiName, int retCode, String desc) {
        String msg = HWMBizSdk.getBizOpenApi().getErrorMessage(retCode);
        if (TextUtils.isEmpty(msg)) {
            Log.i(TAG, "showToast msg == null!");
        }
        String errorMsg = msg + "\n" + "Error code: " + retCode + "\n" + "Error description: " + desc;
        BaseDialogBuilder baseDialogBuilder = new BaseDialogBuilder(DemoActivity.getInstance());
        baseDialogBuilder
                .setMessage(errorMsg)
                .addAction("OK",
                        (dialog, button, index) -> {
                            dialog.dismiss();
                        })
                .show();
    }