我想编写一个像手电筒这样的应用程序(在相机 LED 的帮助下)。
Player player = javax.microedition.media.Manager.createPlayer("capture://video?encoding=video/3gpp");
player.realize();
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
if(videoControl != null)
{
videoField = (Field)videoControl.initDisplayMode( VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field" );
try
{
videoControl.setDisplaySize(1, 1);
}
catch(Exception e)
{
PGLogUtil.logString(e.toString());
}
videoControl.setVisible(true);
add(videoField);
FlashControl flashControl = (FlashControl)
player.getControl("javax.microedition.amms.control.camera.FlashControl");
setFlashlight(true);
}
player.start();
上面的代码完美运行,但我想隐藏videoField
. 当我移除add(videoField)
或使用videoControl.setVisible(false)
时,手电筒不工作。有人可以解释为什么吗?
如何用隐藏的方式打开灯videoField
?