new AlertDialog.Builder(MainActivity.this)
        .setTitle("Difficulty")
        .setItems(
                new String[]{"easy", "medium", "hard"},
                new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int idx) {
                    //...
                }
            }
        )
        .show();本文出自 “Frank” 博客,请务必保留此出处http://zengfanhong.blog.51cto.com/8894077/1674865
原文:http://zengfanhong.blog.51cto.com/8894077/1674865