更改 usbConnectionStateChange 上的黑莓时钟
我正在尝试创建一个应用程序,在建立 USB 连接时替换默认时钟。我无法让我的代码工作。我添加了这样的监听器 UiApplication.getUiApplication().addSystemListener(this);在我的主屏幕中并覆盖
public void usbConnectionStateChange(int state)
{
switch (state)
{
// USB cable is connected
case USB_STATE_CABLE_CONNECTED:
pushScreen(new MyScreen());
break;
// USB cable is disconnected
case USB_STATE_CABLE_DISCONNECTED:
//message("Cable disconnected");
//if (_connected)
//{
// abort();
//}
break;
}
}
我试图在建立 USB 连接时推送 MyScreen() 但它不起作用。 编辑:我也使我的应用程序能够在启动时运行
I'm trying to create an app that replaces the default clock when a usbconnection is made. I can't get my code to work. I added the listener like this UiApplication.getUiApplication().addSystemListener(this); in my MainScreen and overrode
public void usbConnectionStateChange(int state)
{
switch (state)
{
// USB cable is connected
case USB_STATE_CABLE_CONNECTED:
pushScreen(new MyScreen());
break;
// USB cable is disconnected
case USB_STATE_CABLE_DISCONNECTED:
//message("Cable disconnected");
//if (_connected)
//{
// abort();
//}
break;
}
}
I'm trying to push MyScreen() when a USB connection is made but it's not working.
EDIT: I enabled my app to run on startup too
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 PushScreen() 更改为 requestForeground()
changed PushScreen() to requestForeground()