Example usage for android.app AlertDialog setContentView

List of usage examples for android.app AlertDialog setContentView

Introduction

In this page you can find the example usage for android.app AlertDialog setContentView.

Prototype

public void setContentView(@LayoutRes int layoutResID) 

Source Link

Document

Set the screen content from a layout resource.

Usage

From source file:com.oasis.sdk.activity.OasisSdkPayEpinActivity.java

private void showResultDialog(final String res) {
    final AlertDialog d = new AlertDialog.Builder(this).create();
    d.show();/*from  w w  w.j  ava  2  s . co m*/
    d.setContentView(BaseUtils.getResourceValue("layout", "oasisgames_sdk_common_dialog_notitle"));
    d.setCanceledOnTouchOutside(false);

    TextView tv_content = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_content"));
    String content = getResources().getString(BaseUtils.getResourceValue("string",
            TextUtils.isEmpty(res) ? "oasisgames_sdk_epin_notice_3" : "oasisgames_sdk_epin_notice_4"));
    content = content.replace("DIAMOND", res);
    tv_content.setText(content);

    TextView tv_sure = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_sure"));
    tv_sure.setText(
            getResources().getString(BaseUtils.getResourceValue("string", "oasisgames_sdk_common_btn_sure")));
    tv_sure.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            if (!TextUtils.isEmpty(res))
                et_code.setText("");
            d.dismiss();
        }
    });
    TextView tv_cancle = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_cancle"));
    tv_cancle.setVisibility(View.GONE);

    TextView tv_text = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_text"));
    tv_text.setVisibility(View.GONE);

}

From source file:com.oasis.sdk.activity.GooglePlayBillingActivity.java

/**
 * ??????/*from w  w w  .  ja  v a2 s  .  c o  m*/
 * @param purchase
 */
void alert(final Purchase purchase) {
    final AlertDialog d = new AlertDialog.Builder(this).create();
    d.show();
    d.setContentView(BaseUtils.getResourceValue("layout", "oasisgames_sdk_common_dialog_notitle"));
    d.setCanceledOnTouchOutside(false);
    d.setCancelable(false);
    TextView retry = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_sure"));
    retry.setText(getResources()
            .getString(BaseUtils.getResourceValue("string", "oasisgames_sdk_pay_google_notice_alert_retry")));
    retry.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // ?
            d.dismiss();
            setWaitScreen(true);
            check(purchase);
        }
    });
    TextView close = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_cancle"));
    close.setText(getResources()
            .getString(BaseUtils.getResourceValue("string", "oasisgames_sdk_pay_google_notice_alert_close")));
    close.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            d.dismiss();
            setResultInfo(OASISPlatformConstant.RESULT_EXCEPTION_GOOGLEPAY_EXCEPTION,
                    "?????");
            close();
        }
    });

    TextView content = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_content"));
    content.setText(getResources()
            .getString(BaseUtils.getResourceValue("string", "oasisgames_sdk_pay_google_notice_alert_content")));

}