似乎HTC Desire相机和这个版本的Phonegap存在某种问题.问题似乎是HTC在Android上返回相机规格的方式.
—————更新—————
我一直在使用phonegap重写我以前的应用程序的代码,但不是我需要使用相机API.当我在真正的手机上使用它时拍摄照片后崩溃了,我在SendLog中遇到了这个错误.
10-07 09:44:46.980 D/AndroIDRuntime( 1626): Shutting down VM10-07 09:44:46.980 W/dalvikvm( 1626): threadID=1: thread exiting with uncaught exception (group=0x400259f8)10-07 09:44:46.989 W/CameraThread( 1159): Release Camera - set mIsLastCameraClosed to true10-07 09:44:46.989 W/CameraThread( 1159): CameraHandler Message - CLOSE_CAMERA end10-07 09:44:46.989 E/AndroIDRuntime( 1626): FATAL EXCEPTION: main10-07 09:44:46.989 E/AndroIDRuntime( 1626): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null,request=33,result=-1,data=Intent { act=inline-data (has extras) }} to activity {com.theinit.example/com.theinit.example.TestPhoneGapActivity}: java.lang.NullPointerException10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.app.ActivityThread.deliverResults(ActivityThread.java:3734)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.app.ActivityThread.handleSendResult(ActivityThread.java:3776)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.app.ActivityThread.access00(ActivityThread.java:135)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:2166)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.os.Handler.dispatchMessage(Handler.java:99)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.os.Looper.loop(Looper.java:144)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.app.ActivityThread.main(ActivityThread.java:4937)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at java.lang.reflect.Method.invokeNative(Native Method)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at java.lang.reflect.Method.invoke(Method.java:521)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:626)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at dalvik.system.NativeStart.main(Native Method)10-07 09:44:46.989 E/AndroIDRuntime( 1626): Caused by: java.lang.NullPointerException10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.content.ContentResolver.openinputStream(ContentResolver.java:286)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at com.phonegap.CameraLauncher.onActivityResult(CameraLauncher.java:248)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at com.phonegap.DroIDGap.onActivityResult(DroIDGap.java:1346)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.app.Activity.dispatchActivityResult(Activity.java:3931)10-07 09:44:46.989 E/AndroIDRuntime( 1626): at androID.app.ActivityThread.deliverResults(ActivityThread.java:3730)10-07 09:44:46.989 E/AndroIDRuntime( 1626): ... 11 more
有谁知道为什么会这样?
这是我的Camera.Js
这是我的Camera.Js
var options = { quality : 75,destinationType : Camera.DestinationType.DATA_URL,sourceType : Camera.PictureSourceType.CAMERA,allowEdit : true,targetWIDth: 100,targetHeight: 100 };function capturePhoto() { // Take picture using device camera and retrIEve image as base64-encoded string navigator.camera.getPicture(onPhotoDataSuccess,onFail,options);}function onPhotoDataSuccess() { // Uncomment to vIEw the base64 encoded image data var theHTML = ''; theHTML = '<div ID="info">CameraSuccess</div>'; document.getElementByID('main').INNERHTML = theHTML;}function onFail(message) { // Called if something bad happens. alert('Failed because: ' + message);}
希望能帮助到你
谢谢大家
解决方法 我刚刚在PhoneGap问题列表中帮助了一个有同样错误的人.我相信你错过了许可:<uses-permission androID:name="androID.permission.WRITE_EXTERNAL_STORAGE" />
来自您的AndroIDManifest.xml文件.我们需要能够将捕获的图像写入.jpg文件.
总结以上是内存溢出为你收集整理的android – 检索数据时Phonegap相机故障全部内容,希望文章能够帮你解决android – 检索数据时Phonegap相机故障所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)