Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 摄像机问题_Image_Blackberry_Camera - Fatal编程技术网

Image 摄像机问题

Image 摄像机问题,image,blackberry,camera,Image,Blackberry,Camera,我遇到了一些问题时,试图让相机工作相应的。。。摄像机演示可在8520设备上使用,但在9780设备上无法使用,因为该设备没有存储卡错误 错误类java.lang.ArrayOutOfBoundsException:索引0>=0 我的代码示例: 公共类MyScreen扩展了主屏幕{ 玩家(p); 视频控制; 文件连接文件连接; 字符串路径; 字符串GetfileName; LabelField GetPhotofileName=新LabelField,LabelField.FOCUSABLE{ 受保

我遇到了一些问题时,试图让相机工作相应的。。。摄像机演示可在8520设备上使用,但在9780设备上无法使用,因为该设备没有存储卡错误

错误类java.lang.ArrayOutOfBoundsException:索引0>=0

我的代码示例:

公共类MyScreen扩展了主屏幕{ 玩家(p); 视频控制; 文件连接文件连接; 字符串路径; 字符串GetfileName; LabelField GetPhotofileName=新LabelField,LabelField.FOCUSABLE{ 受保护的布尔导航ClickInt状态,int时间{ Dialog.alertClicked; 返回true; } }; 公共静态布尔SDCardAvailability{ 字符串根=null; 枚举e=FileSystemRegistry.listRoots; 而e{ root=字符串e.nextElement; 如果root.equalsIgnoreCasesdcard/{ }如果root.equalsIgnoreCasestore/{ } } 类MySDListener实现FileSystemListener{ public void rootChangedint状态,字符串rootName{ 如果state==添加的根{ 如果rootName.equalsIgnoreCasesdcard/{ } }如果state==ROOT\u已删除,则为else{ } } } 返回true; } 受保护的布尔调用操作{ 布尔处理=super.invokeActionaction; IFSDCard可用性{ PATH=System.getPropertyfileconn.dir.memorycard.photos+Image+System.currentTimeMillis+.jpg;//此处str具有当前日期和时间; }否则{ //PATH=System.getPropertyfile:///store/home/user/pictures/+Image_u3;+System.currentTimeMillis+.jpg; PATH=System.getPropertyfileconn.dir.photos+Image+System.currentTimeMillis+.jpg; } 如果!处理{ ifaction==操作调用{ 试一试{ 字节[]rawImage=\u videoControl.getSnapshotnull; System.out.println------1; fileconn=FileConnectionConnector.openPATH; System.out.println----2; 伊菲利康{ fileconn.delete; System.out.println------3; } fileconn.create; System.out.println----4; OutputStream os=fileconn.openOutputStream; System.out.println----5; os.WriterWimage; GetfileName=fileconn.getName; System.out.println----6; System.out.printlnGetfileName-----+GetfileName; fileconn.close; System.out.println----7; 操作系统关闭; Status.showImage被捕获,200; GetPhotofileName.setTextGetfileName; System.out.println----8; 如果p!=null _p、 接近; System.out.println----9; }卡奇{ 如果p!=null{ _p、 接近; } iffileconn!=null{ 试一试{ fileconn.close; }捕获IOE1异常{ //如果操作不是单击TrackWheels意味着转到菜单选项,那么我们什么也不做; } } } } } 处理退货; } 公共MyScreen{ setTitleCamera应用程序; 试一试{ System.out.printlnDebug----10; _p=javax.microedition.media.Manager.createPlayercapture://video?encoding=jpeg&width=1024&height=768; _p、 认识到; _videoControl=videoControl\u p.getControlVideoControl; System.out.printlnDebug----11; 如果_videoControl!=null{ Field videoField=Field\u videoControl.initDisplayMode videoControl.USE\u GUI\u原语,net.rim.device.api.ui.Field; _videoControl.setDisplayFullScreentrue; System.out.printlnDebug----12; _videoControl.setVisibletrue; _p、 开始; System.out.printlnDebug----13; ifvideoField!=null{ addvideoField; System.out.printlnDebug----14; } } }卡奇{ 如果p!=null{ _p、 接近; } Dialog.alerte.toString; } addGetPhotofileName; } } 在8520上有存储卡代码工作正常在9780上没有存储卡代码停在System.out.printlndebug--1,有人能告诉我我的代码有什么问题吗

  public static boolean SdcardAvailabulity() {
     String root = null;
     Enumeration e = FileSystemRegistry.listRoots();
     while (e.hasMoreElements()) {
         root = (String) e.nextElement();
         if( root.equalsIgnoreCase("sdcard/") ) {
             return true;
         }else if( root.equalsIgnoreCase("store/") ) {
             return false;
         }
     }
     class MySDListener implements FileSystemListener {
         public void rootChanged(int state, String rootName) {
             if( state == ROOT_ADDED ) {
                 if( rootName.equalsIgnoreCase("sdcard/") ) {
                 }
             } else if( state == ROOT_REMOVED ) {
             }
         }
     }
     return true;
}
这是解决方案,我的SD卡a
Availability代码仅返回true,这导致黑莓没有插入存储卡时图片无法保存。@Eugen Martynov请通读代码,您会看到它就在那里:

到这个聊天室来:我没有找到调试--1条消息。同样,我看到您的代码在SDCardAvailability中总是返回true,所以SD卡在您的代码中总是可用的