Using wait in AsyncTask

前端 未结 6 1539
逝去的感伤
逝去的感伤 2021-02-01 01:15

When using a wait in an AsyncTask, I get ERROR/AndroidRuntime(24230): Caused by: java.lang.IllegalMonitorStateException: object not locked by thr

6条回答
  •  悲哀的现实
    2021-02-01 02:06

    @Override
            protected String doInBackground(String... params) {
                // TODO Auto-generated method stub
                try {
                    Thread.currentThread();
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                return null;
    
            }
    

提交回复
热议问题