Phonegap 2.3.0和ForegroundCamera插件 [英] Phonegap 2.3.0 and the ForegroundCamera plugin

查看:179
本文介绍了Phonegap 2.3.0和ForegroundCamera插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Phonegap 2.3.0和从谷歌代码新的ForegroundCamera插件..我遵循的说明仔细,在我的Eclipse设置我验证项目时出现以下错误:

I'm using Phonegap 2.3.0 and the new ForegroundCamera plugin from Google Code.. I followed the instructions carefully, and in my Eclipse setup I got the following errors when validating the project:


  • 无法从ForegroundCameraLauncher强制转换为插件

  • ctx无法解析或不是字段(x2)

  • R无法解析为变量(x4)

  • 方法成功(PluginResult,String)未定义类型
    ForegroundCameraLauncher

  • Cannot cast from ForegroundCameraLauncher to Plugin
  • ctx cannot be resolved or is not a field (x2)
  • R cannot be resolved to a variable (x4)
  • The method success(PluginResult, String) is undefined for the type ForegroundCameraLauncher

现在,我通过更新一些已弃用的代码行解决了前面三个错误(我希望我得到解决 - 它不再显示错误) ..

Now, I solved the first three of the above errors by updating some deprecated code lines (I hope I got it solved - it doesn't show the errors anymore)..

第一个错误是通过将import org.apache.cordova.api.Plugin;行中的插件更改为CordovaPlugin来修正的。在ForegroundCameraLauncher.java中。
ctx在这两个地方被cordova.getActivity()替换,这导致了麻烦。
这个东西与R是固定的做一些库的变化,使它创建一个R对象(对不起,我不知道如何解释这个正确的方式,因为我没有太多的Eclipse经验)。

The first error was corrected by changing Plugin to CordovaPlugin in the line "import org.apache.cordova.api.Plugin;" in ForegroundCameraLauncher.java. ctx was replaced with cordova.getActivity() at those two places, where it caused trouble. This thing with R was fixed by doing some library changes which made it create an R object (sorry, I don't know how to explain this the right way, as I'm not too experienced with Eclipse yet).

使用四个错误消息的最后一个,我试图做一个临时修复通过注释掉ForegroundCameraLauncher.java中的这两行(行的this.success ...)。但是当在我的应用程序中拍照时,从相机实例返回时会崩溃。

With the last one of the four error messages, I tried to make a temporary fix by commenting out those two lines in ForegroundCameraLauncher.java (the lines with "this.success"...). But when taking a picture in my app, it crashes the whole thing upon returning from the camera instance..

任何人都知道发生了什么事?我真的很高兴在这里得到一些指针:)

Anyone know what's going on? I'd really be happy to get a few pointers here :)

最后一个错误显然是你应该关注的一个;)我只是想包括一些

The last error is obviously the one you should be focusing on ;) I just wanted to include some of the error fixing process, if others have experienced the same errors.

推荐答案

查看此提交以查看Cordova中已更改的内容: https://github.com/apache/cordova-android/commit/205215d409c4f75e958a9c09c0b4a38bd9a859​​ac

See this commit to see what has changed in Cordova: https://github.com/apache/cordova-android/commit/205215d409c4f75e958a9c09c0b4a38bd9a859ac

取代

this.success(new PluginResult(PluginResult.Status.OK,getRealPathFromURI(uri,this.ctx)) ,this.callbackId);

with

this.callbackContext.success(getRealPathFromURI(uri,cordova)); code>。

Replace
this.success(new PluginResult(PluginResult.Status.OK, getRealPathFromURI(uri, this.ctx)), this.callbackId);
with
this.callbackContext.success(getRealPathFromURI(uri, cordova));.

根据提交更新执行函数,并更新 takePicture

Update the execute function as per that commit, and update takePicture.

之后,我有ForgroundCamera插件使用Cordova 2.3。现在就做一些更多的测试和清理。

After that I have the ForgroundCamera plugin working with Cordova 2.3. Going to do some more testing and clean up now.

这篇关于Phonegap 2.3.0和ForegroundCamera插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆