本文介绍了我怎样才能调用黑莓摄像头和保存是采取在我的code中的图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的用户通过使用内置摄像头拍摄一张照片作为附件。

I'd like my user to take a picture as an attachment by using the built in camera.

有什么方法来调用上的一个按钮preSS相机和保存生成的拍摄的照片?

Is there someway to invoke the camera on a button press and save the resulting taken picture?

推荐答案

另一种选择是使用BlackBerry API调用来启动本机摄像头的应用和监听文件系统事件:

The other option is to use the BlackBerry Invoke API to start the native camera application and listen for a file system event:

Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments());

再后来:

class FileExplorerDemoJournalListener implements FileSystemJournalListener {
    public void fileJournalChanged() {
        long nextUSN = FileSystemJournal.getNextUSN();
        for (long lookUSN = nextUSN - 1; lookUSN >= _lastUSN && msg == null; --lookUSN) {
            FileSystemJournalEntry entry = FileSystemJournal.getEntry(lookUSN);
            if (entry == null) {
                break;
            }
            String path = entry.getPath();
            if (path != null) {
                if (path.endsWith("png") || path.endsWith("jpg") || path.endsWith("bmp") || path.endsWith("gif") ){
                    switch (entry.getEvent()) {
                        case FileSystemJournalEntry.FILE_ADDED:
                            //either a picture was taken or a picture was added to the BlackBerry device
                            break;
                        case FileSystemJournalEntry.FILE_DELETED:
                            //a picture was removed from the BlackBerry device;
                            break;
                    }
                }
            }
        }
    }
}

最后...

Application.addFileSystemJournalListener(new FileExplorerDemoJournalListener());

这将让你最有路......摘自:http://docs.blackberry.com/en/developers/deliverables/11942/Detect_when_img_is_added_or_removed_file_system_740288_11.jsp

This will get you most of the way there... taken from: http://docs.blackberry.com/en/developers/deliverables/11942/Detect_when_img_is_added_or_removed_file_system_740288_11.jsp

这篇关于我怎样才能调用黑莓摄像头和保存是采取在我的code中的图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 16:53