在黑莓中通过后台线程在 UI 上显示图像
我正在寻找一种从后台线程在用户界面上显示图像的方法。该后台线程接收字节数组形式的流图像。我需要在我的用户界面上显示它 有人可以帮忙吗?
我已经尝试从后台线程访问位图字段,但没有任何反应,
谢谢
bmp = Bitmap.createBitmapFromBytes(jpegBytes, 0, jpegBytes.length, 1);
final Bitmap bit = bmp;
final byte [] jp = jpegBytes;
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run()
{
camView.jpegBytes = jp;
System.out.println(bit);
camView.bmpStream.setBitmap(bit);
//camView.bmpStream.
}
});
I am looking for a way to display images on my UI from a background thread. This background thread recieves streaming images in the form of byte array. I need to diplay it on my UI
Can anyone help with this please?
I already tried accessing the bitmap field from the background thread but nothing happens
Thanks
bmp = Bitmap.createBitmapFromBytes(jpegBytes, 0, jpegBytes.length, 1);
final Bitmap bit = bmp;
final byte [] jp = jpegBytes;
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run()
{
camView.jpegBytes = jp;
System.out.println(bit);
camView.bmpStream.setBitmap(bit);
//camView.bmpStream.
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您需要更改主屏幕,意味着如果您需要从后台线程向主屏幕添加字段,您需要调用
方法来重新绘制屏幕,否则屏幕
Ex 中不会发生任何更改:
If you need to change the Main Screen means if you need to add field to Main Screen from the Background thread you need to call
method to repaint the screen otherwise no change will place in Screen
Ex:
嘿伙计们,我设法找到了我在使用对父类的引用时遇到的问题。如果您有对主类的引用,我在问题中发布的上述代码将非常有效。
Hey guys I managed to find the problem I had an issue with the used of references to my parent class. the above code I have posted in the question works perfect if you have a reference to the main class.