GuiUtils.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:MobileAppForPatient 作者:
public static Dialog showConfirmDialog(Activity activity, boolean cancelable, String title, String message,
           final CustomAlertOnClickListener backHandler) {

       Dialog dialog = new Dialog(activity, R.style.CustomDialog);
       dialog.setContentView(R.layout.confirm_dialog);
       dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
       dialog.setCancelable(cancelable);

       TextView tvTitle = (TextView) dialog.findViewById(R.id.tv_title);
       TextView tvContent = (TextView) dialog.findViewById(R.id.tv_content);
       Button btnBack = (Button) dialog.findViewById(R.id.btn_confirm);

       if (!TextUtils.isEmpty(title)) {
           tvTitle.setText(title);
       }
       tvContent.setText(message);

       dialog.show();

       final Dialog inDialog = dialog;
       btnBack.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               if (backHandler != null) {
                   backHandler.onClick(inDialog, v);
               }
           }
       });

       return dialog;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号