Dialog does not appear

后端 未结 5 2026
鱼传尺愫
鱼传尺愫 2021-01-12 01:19

I use following code:

public class Settings extends Activity implements OnClickListener {

    private Activity activity;
    private AlertDialog.Builder bui         


        
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-12 02:17

    I have this issue and maybe this answer can help someone.

    I was running the code to show the AlertDialog on a non-ui thread. After using:

    runOnUiThread(new Runnable()
        {
            @Override
            public void run()
            {
                ShowAlert();
            }
        });
    

    the AlertDialog worked.

提交回复
热议问题