Java me j2me抛光快照屏幕

Java me j2me抛光快照屏幕,java-me,j2mepolish,Java Me,J2mepolish,我正试图用手机的摄像头拍摄以下片段的图像 snapShotScreen = new SnapshotScreen( "Snapshot" ); snapShotScreen.addCommand(cmdBack ); snapShotScreen.addCommand(cmdCapture); snapShotScreen.setCommandListener( new ThreadedCommandListener( this )

我正试图用手机的摄像头拍摄以下片段的图像

        snapShotScreen = new SnapshotScreen( "Snapshot" );
        snapShotScreen.addCommand(cmdBack );
        snapShotScreen.addCommand(cmdCapture);
        snapShotScreen.setCommandListener( new ThreadedCommandListener( this ) );
        this.display.setCurrent(snapShotScreen);
然后返回一个空值。我的目标设备是诺基亚/2700_classic,它具有mmapi功能,我仍然不明白它为什么不工作。有人有什么建议吗?

为了让Android摄像头正常工作,您需要编辑MidletBridge.java文件。 您将找到以下文件:

J2ME-Polish\u Root\j2mepolish src\J2ME\src\de\ough\Polish\android\midlet\MidletBridge.java

您需要在两种方法中添加通用android摄像头代码(在MidletBridge活动中)以及一个公共字节[],以便在拍照后检索数据,单击保存并设置字节[]图像:

MidletBridge.java file:

public byte[] imagebytearray = null;

public void startCameraIntent(){
        Intent i = new Intent("android.media.action.IMAGE_CAPTURE");
        startActivityForResult(intent, 10121);
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
            case 10121: 
                imagebytearray = (byte[]) data.getExtras().get("data");
                break;
        }
}
完成此操作后,您将需要通过调用

de.enough.polish.android.midlet.MidletBridge m = new de.enough.polish.android.midlet.MidletBridge();
m.startCameraIntent();
//I couldnt remember if the code continues here after you have taken the picture
byte[] img = m.imagebytearray;
//If the code doesnt pause here, you can just use a button to retreive the image or store the 
//image within the RMSStorage -- need some more code for that -- and then retreive it that way.
我希望这能帮助一些人,因为我花了几个星期才走到这一步。我的应用程序运行良好,已被出售。我丢失了源代码,否则所有的J2ME波兰用户都会非常高兴。曾与黑莓、诺基亚、安卓以及windows ce合作


顺便说一句。。当时我已经把这整段代码发给了J2ME波兰人,但看起来他们并没有发布。如果你真的想要所有的来源。。。去打扰他们。

找到了解决方案,快照屏幕需要像这样附加一个样式://#style snapshotScreen snapshotScreen=new snapshotScreen(“快照”);