简体   繁体   中英

Android - alert dialog appears momentarily than turns black

I'm using a list view and the following code to show an alert dialog:

    exerciseListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
                new AlertDialog.Builder(absActivity.this).setView(R.layout.layout_dialog)
                        .setTitle("are you sure?").
                        setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {

                            }
                        }).setNegativeButton("No", null).show();
                return true;
            }
        });
    }

The alert dialog appears momentarily like this:

在此处输入图像描述

than immediately disappears and turns:

在此处输入图像描述

Apperantly the problem was in the emulator, after wiping the phone's data the problem was solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM