将图像从 BlackBerry 中的文件系统分配给 BitmapField
在黑莓手机中,我有一个位图字段。我希望在位图字段的单击事件上实现这一点。设备中的文件系统应该打开,用户将从文件系统中选择一个图像,该图像将被分配给位图字段。
我是在位图字段上处理此类事情的新手。请问有人可以吗 为我提供一些代码或链接来执行此操作?
In BlackBerry I have a bitmapfield. I want that on the click event of the bitmapfield. The file system in the device should get opened and the user will select an image from the file system and that image will get assigned to the bitmapfield.
I am new to working with such things on a bitmapfield. Would any one please
provide me some code or link for doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用
fieldChanged
方法实现FieldChangeListener
并通过myBitmapField.setChangeListener(...)
设置它的实例。 这是一个合理的示例 对在问题中。现在,在
fieldChanged()
内,您需要调用文件选择器。如果您幸运的话,您可以开发 5.0 或更高版本,FilePicker 是您要使用的类。对于较旧的黑莓手机,没有文件选择器,您需要自己开发它。好消息是,您可以将其基于示例中的现有代码,
components\samples\com\rim\samples\device\fileexplorerdemo
中有文件资源管理器演示。You need to implement
FieldChangeListener
withfieldChanged
method and set an instance of it viamyBitmapField.setChangeListener(...)
. Here is a reasonable example right in the question.Now, inside the
fieldChanged()
, you need to call a file picker. If you are lucky and you can develop for 5.0 or above, FilePicker is the class you want to use.For older BlackBerries there is no file picker, you would need to develop it yourselves. Good news is, you can base it on an existing code from examples, there is File Explorer demo in
components\samples\com\rim\samples\device\fileexplorerdemo
.