setNegativeButton with icon image Android

时间:2014-08-19 16:54:28

标签: android android-alertdialog

我使用以下代码关闭警报对话框:

    protected void onPostExecute(String result) {
                /*Toast.makeText(getActivity(), result,
                        Toast.LENGTH_SHORT).show(); */

                if ( result.equals("0") ){

                    AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); 
                    alert.setTitle("Patrocinador");

                    alert.setMessage("Lo sentimos");

                    alert.setNegativeButton("Close", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.dismiss();
                        }
                    });

                    alert.show();





                }

}

问题是我想替换文字"关闭" for icon png

我怎么能这样做?

谢谢

0 个答案:

没有答案