开发者

Assigning image to BitmapField from file system in BlackBerry

开发者 https://www.devze.com 2023-02-03 14:32 出处:网络
In BlackBerry I have a bitmapfield. I want that on the click event of the bitmapfield. The file system in the device should g开发者_开发百科et opened and the user will select an image from the file sy

In BlackBerry I have a bitmapfield. I want that on the click event of the bitmapfield. The file system in the device should g开发者_开发百科et 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?


You need to implement FieldChangeListener with fieldChanged method and set an instance of it via myBitmapField.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.

0

精彩评论

暂无评论...
验证码 换一张
取 消