我用Invoke.invokeApplication调用system camera,源码如下,但是camera的界面,在CameraScreen的后面,无法再前台显示,只有在CameraScreen关闭之后,才能显示出拍照的界面。如何将CameraScreen移到后面去,以显示出systemcamrea的界面?
- Java code
import java.util.Vector;import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.MainScreen;import net.rim.device.api.util.StringUtilities;import net.rim.blackberry.api.invoke.CameraArguments;import net.rim.blackberry.api.invoke.Invoke;import net.rim.device.api.ui.*;public class SysCamera extends UiApplication{ public static void main(String[] args) { SysCamera demo = new SysCamera(); demo.enterEventDispatcher(); } private SysCamera() { CameraScreen screen = new CameraScreen(); Ui.getUiEngine().pushGlobalScreen(screen ,1, UiEngine.GLOBAL_QUEUE); }}final class CameraScreen extends MainScreen{ CameraScreen() { setTitle( new LabelField( "SysCamera Demo" , LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH ) ); CameraArguments sysCamera=new CameraArguments(CameraArguments.ARG_CAMERA_APP ); Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, sysCamera); }}
------解决方案--------------------
使用Manager类。注意是javax.microedition.media.Manager
JDE 4.6以上的sample中有正对它进行拍照调用的例子。可以去看看,并非像INVOKE那样调用照相程序,而是一个自己定义的界面中嵌入照相功能,自然可以后台运行自动拍摄。
另:
招收手机开发精英,组团,有兴趣的PM我