Phonegap 2.0.0 - getApplicationContext

时间:2012-09-25 20:33:34

标签: android cordova phonegap-plugins

我正在尝试在我的插件中获取应用程序上下文,但它会抛出此错误:

  

无法在未调用的线程内创建处理程序   Looper.prepare()

这是我的代码:

ResourceManager manager = ResourceManager.getInstance(this, this.ctx.getApplicationContext());

我甚至将我的代码更改为:

ResourceManager manager = ResourceManager.getInstance(this, this.cordova.getContext());

ResourceManager manager = ResourceManager.getInstance(this, this.cordova.getActivity());

也尝试过:

ResourceManager manager = ResourceManager.getInstance(this, cordova.getActivity().getApplicationContext());

但它仍会抛出相同的错误消息

1 个答案:

答案 0 :(得分:0)

修复:问题与获取applicationContext无关,ResourceManager中存在问题