咖啡伴侶

          呆在上海
          posts - 163, comments - 156, trackbacks - 0, articles - 2
          遇到的情況
          AsyncTask
          protected GAViewer doInBackground(Activity... params) {
              ......
              GAViewer viewer = new GAViewer(result, drawActivity.getApplicationContext());
              return viewer;
          }

          產(chǎn)生
          Can't create handler inside thread that has not called Looper.prepare()
          異常

          原因估計(jì)
          1.viewer 是個(gè) SurfaceView ,而doInBackground是不允許操作UI的
          2.drawActivity.getApplicationContext() 已經(jīng)操作了UI ?maybe

          Feedback

          # re: Can't create handler inside thread that has not called Looper.prepare() 異常問題[未登錄]  回復(fù)  更多評(píng)論   

          2011-11-28 20:06 by mark
          android webkit plugin

          線程里回調(diào)javascript函數(shù)時(shí),插件直接崩潰,并提示:

          WARN/System.err(296): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
          原因是,另外一線程不能更新UI主線程。插件提供同步函數(shù)。用這個(gè)pluginthreadasynccall,再調(diào)用invokeDefault就可以了。

          主站蜘蛛池模板: 辽阳市| 西和县| 长海县| 抚州市| 彭州市| 元阳县| 壶关县| 兴宁市| 贵定县| 昌平区| 栾川县| 昭通市| 伊宁县| 白河县| 永和县| 郎溪县| 阜南县| 田林县| 师宗县| 屯门区| 会理县| 弥渡县| 望城县| 启东市| 广平县| 宜昌市| 巴林左旗| 象州县| 苏尼特右旗| 东阿县| 贵溪市| 澎湖县| 海宁市| 平泉县| 六盘水市| 大庆市| 济阳县| 乐都县| 河北省| 博兴县| 平原县|