Camera to call and wait for the photo?

Hello world

First post on these forums, but I've been lurking here for a while. I have a simple question that can have a simple answer, and I hope someone here can enlighten us on this issue.

I'm looking to call the camera of my application, I can do it quite easily. In addition, I have a listener of filesystem implemented seeking a .jpg file saved after that the user takes a photo. Here are the relevant lines of code (more or less):

Listener = new FileSystemJournalListener() {}

public void fileJournalChanged() {}

Long USN = FileSystemJournal.getNextUSN ();

for (long I = USN - 1; i > = lastUSN; i--) {}

Entry FileSystemJournalEntry = FileSystemJournal.getEntry (i);

If (input! = null) {}

If (entry.getEvent () == FileSystemJournalEntry.FILE_ADDED: entry.getEvent () == FileSystemJournalEntry.FILE_CHANGED: entry.getEvent () == FileSystemJournalEntry.FILE_RENAMED) {}

If (entry.getPath () .indexOf (".jpg")! = - 1) {}

lastUSN = USN;

photoPath = entry.getPath ();

}

}

}

}

lastUSN = USN;

}

}

UiApplication.getUiApplication () .addFileSystemJournalListener (listener);

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

My problem is I want to access and extract the image from the camera in a way series application, then I would like my request for locking/blocking/wait until what the auditor has identified a new image file. I believe that this is possible, but I'm not familiar with how to do it. In my debugging experience, at least on the Simulator, invokeApplication is threaded (asynchronous) and my request is still ongoing in the background, even if the camera application is active and on the foreground. I tried to add a dummy while loop after the call to Invoke that checks whether my application is in the foreground (using isForeground) but has not lead me on the path.

I'm working with JDE 4.6.1 and 4.7. Any help would be greatly appreciated!

Best,

Wire update

Hi Peter,.

Thanks again for your response. I'm really not in one of the videos/images . You can always check my github profile (www.github.com/filmaj), which also contains my range of PhoneGap - it contains the latest code of BlackBerry for our project. In addition, PhoneGap is completely open source and under license by virtue of the MIT, which is pretty liberal, so feel free to grab the code and play with it / use it at your leisure!

Thanks for the info on the thread of events, which is very insightful. And Yes, almost all PhoneGap runs on the event Thread (except for the recovery of the resource - two resources the application external or local-unit, i.e. the pages html, css, js, images, etc.). It is indeed a difficult situation, but I think I have the solution, but it does not actually the code Java of BlackBerry. I think I can actually solve this problem as soon as the end of JavaScript.

For context, here's a brief overview / example of how PhoneGap works on a BlackBerry:

1. developer making an app with PhoneGap called something like navigator.camera.getPicture (success, failure) of JavaScript on the access to its Web site, with the 'success' and 'failure' based on the handles to reminders for image retrieval success or failure, respectively.

2 some PhoneGap JavaScript wrapper code sets a cookie (document.cookie = "foobar"-call with a particular PhoneGap message format, in this case for the camera.)

3. We then carry on native code of BlackBerry. Object BrowserField, that displays web application pages and executes the JavaScript Shell, then intercepts this cookie-setting event (via the eventOccured to the RenderingApplication method and Event.EVENT_SET_HTTP_COOKIE event type) and numbers which native device to recover/call feature.

4. the specific device feature is called and returns a string from a combination of code JavaScript logic and JSON (code object for data transport representation). This string is stored in a Java vector, which is a member of class PhoneGap.

5. at this point, the cookie-setting event method has finished running, execution returns to the wrapper of PhoneGap JavaScript function. Now, we get the contents of JS document.cookie. As done previously, using the same approach, catch us the event "getCookie" and fill it with the contents of the Java vector we populated earlier. It finally passed into the web page's JavaScript.

6 back in the land of JavaScript, the last step is to eval() the contents of the cookie, fill data members and call reminders on the right.

So my solution is to simply ask document.cookie (and therefore indirectly on the contents of the Java vector election) in a defined - for example, every second - interval instead of immediately after the launch of the functionality of the device and only once. In this way, the app will be keep polling the vector object to the new answers PhoneGap and evaluate constantly.

In all cases, you can not directly solved my problem, but you led me in the right direction! Congratulations to you, Sir!

Thanks again,

Wire update

Tags: BlackBerry Developers

Similar Questions

  • I bought adobe illustrator and waiting for the e-mail so I can download it but it does not appear

    I bought adobe illustrator and waiting for the e-mail so I can download it but it does not appear

    Hello

    I don't see no active membership/registration under the Adobe Id on the forums.

    Please confirm if there is any other Adobe Id in which you may have subscribed.

    Kind regards

    Sheena

  • HA elections issues, getting only one agent as master and waiting for the second time

    I am facing a strange question HA.

    Much more kit (2 hosts, vcenter) virtual, DAS storage. VSphere 5.1 latest patches. 1 datacenter, 1 together inside with 2 guests.

    While trying to activate HA (with default settings), an election was held where a master and an error in time-out for the second host. Funny thing is that if I force a new election manually on the two hosts, the first I click to become master, second error timeout showing later.

    The two machines are able to ping the other subnet vmotion and network management subnet.

    I triple check the connections & Configuration of VLAN on the physical switch-> no other success

    I changed vswitch assignment & design in at least 4 different ways-> no other success

    I did break the cluster and datacenter, recreate new-> same question.

    I took both of my hosts (1 at a time) off the VirtualCenter and back in--> no other success

    I do NOT recreate my vCenter (of less not yet...)

    I have NOT reinstall any of my guests from scratch (of less not yet...)

    All constructive ideas?

    There is a kind of strangeness network here. FDM on each host cannot see the election messages sent by the other (on port udp 8182) so each one chooses himself as captain and brand a title "fdmUnreachable". They mark the other as network partitioned because they can ping (using icmp). It's just the udp/TCP traffic 8182 which is not cross.

    Elisha

  • Wait for the entry?

    Hi all

    I need to create a custom entry dialog box and the problem I encountered is that I can't figure out how to make my request to wait for the user to complete the entries in the framework. When you use a JDialog or JOptionPane application will stop running and wait for the dialog box to close. My question is how to do something similar without using a JOptionPane or JDialog. I just can't figure out how to get the same effect by using a JFrame or other component. I know I could just use a JDialog or JOptionPane to get input from the user, but I'm just curious to know how I can stop running and wait for the entry as the JOptionPane allows you to do, but without using a JOptionPane or JDialog.

    Thank you for your help :)
    Nathan D.

    -----
    : Edit:
    I forgot to mention that the reason main I avoids JDialogs is I need the entry dialog box to be internal not external application I use mode exclusive fullscreen. And a JOptionPane does not allow me to add the other components too it such as JLabels and other GUI. I just need a way to get input from a component or internal window and wait for the entry as a JOptionPane or JDialog.
    -----

    A NBS are:

    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    
    
    
    public class Main extends JFrame implements ActionListener {
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            new Main();
        }
    
    
        JButton go = new JButton("Show custom input dialog");
    
        public Main() {
            setSize(300,150);
            setLocationRelativeTo(null);
            setLayout(new FlowLayout());
            go.addActionListener(this);
            add(go);
            setVisible(true);
        }
    
        public void actionPerformed(ActionEvent e) {
            InputDialog d = new InputDialog();
    
            /*
             * Here is the problem it is necessary that I create a
             * custom input dialog to allow further modifications however
             * i'm not sure how to wait for the user to enter text and press
             * continue in that input dialog. Unlike JOptionPane the code executes
             * before the user presses continue. My question is how do I wait for the user
             * to press continue in the InputDialog before I call d.getString(); without making the main
             * application unresponsive.
             */
    
            String returnValue = d.getString();
            System.out.println("return value "+returnValue); //will be null or empty because application doesn't wait for input.
        }
    
    
        class InputDialog extends JFrame implements ActionListener {
            JTextField f = new JTextField();
            JButton go = new JButton("Continue");
    
            public InputDialog() {
                setTitle("Custom Input Dialog");
                setSize(300,150);
                setLocationRelativeTo(null);
                setLayout(new FlowLayout());
                f.setPreferredSize(new Dimension(100,25));
                go.addActionListener(this);
                add(f);
                add(go);
                setVisible(true);
            }
    
            public void actionPerformed(ActionEvent e) {
    
            }
    
            public String getString() {
                return f.getText();
            }
        }
    }
    Published by: neptune692 on January 3, 2011 13:25

    neptune692 wrote:
    .. a JOptionPane does not allow me to add the other components too it such as JLabels and other GUI. ..

    Of course, it does!

    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    
    public class DumbNameMain extends JFrame implements ActionListener {
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            new DumbNameMain();
        }
    
        JButton go = new JButton("Show custom input dialog");
    
        public DumbNameMain() {
            setSize(300,150);
            setLocationRelativeTo(null);
            setLayout(new FlowLayout());
            go.addActionListener(this);
            add(go);
            setVisible(true);
        }
    
        public void actionPerformed(ActionEvent e) {
            JTextField f = new JTextField(10);
            JButton go = new JButton("Continue");
            JPanel p = new JPanel(new FlowLayout());
            p.add(f);
            p.add(go);
            JOptionPane.showMessageDialog( this, p );
    
            String returnValue = f.getText();
            System.out.println("return value "+returnValue);
        }
    }
    
  • How can I find the number of pixels is in my photos of the ipad? I sell on ebay and they have new requirements for the photos. 500 pixels on the longest side. Is it possible to increase the pixels on already took pictures?

    How can I find the number of pixels is in my photos of the ipad? I sell on ebay and they have new requirements for the photos. 500 pixels on the longest side. Is it possible to increase the pixels on already took pictures?

    See if this application works for you > https://itunes.apple.com/us/app/image-size/id670766542?mt=8

  • Make a phone call by program - the wait for the user to input?

    Hello

    I use the following code to place a phone call from my application:

    Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, new PhoneArguments(PhoneArguments.ARG_CALL, phoneNumber));
    

    and it seems to work, at least in the Simulator.  However, when this line running the Simulator dials the number immediately.  Peux-I rather the phone displays the number and wait that the user press 'call '?

    I know that I can warn the user with Dialog.ask (...), and if it's the only thing to do I will do.  I'm just curious to know if I can get the phone to do so.

    arkadyz wrote: instead can have the phone displays the number and wait that the user press 'call '?

    No, this is not currently supported.  You can use a dialog box inside your own application as you describe.

  • image sizes for the photo and moodboards clipping masks

    Hello

    I place images/photos to the web and Pinterest on my plans to work in Illustrator for both mood/inspiration cards as well to use with clipping masks.

    Should I adjust the size of the image files in photoshop before placing them so that my illustrator file does not become too large?

    Or can I use object > rasterize > and choose the resolution/ppi to do the same thing?

    Thank you

    LM

    elizabethm56272654 wrote:

    Should I adjust the size of the image files in photoshop before placing them so that my illustrator file does not become too large?

    Of course, you must define your own strategies for these questions according to your needs. Sure raster image data, excess will swell your files unnecessarily, but according to the availability of extra storage space in your computing environment and your ultimate output intent, may not be worth the extra time and effort for the goal-size things in Photoshop before placement. Only you can decide that priority. If the images are 'of the web and Pinterest', chances are, they are already low-resolution, and you would not shave number of bytes out of them anyway.

    Or can I use object > rasterize > and choose the resolution/ppi to do the same thing?

    N ° which is designed for elements vector rasterize at your chosen resolution. It will not change the resolution to something that is already rasterized.

  • I like the develop module, but I'm doing something wrong in the library in library, under 'Catalogue, all the photos', all my photos appear showing the stars, cropping, and development. The problem is that these changes are not for the photos on my hard d

    I love the develop module, but I'm doing something wrong in the library

    In the library, under 'Catalogue, all the photographs', all my photos appear showing the stars, cropping, and development. The problem is that these changes are not for the photos on my hard drive. When I re-import them in Lr, the changes are not there. My workflow is to do nothing after development or export them to the original with a new file name destination. Anyway, it is that they get a new file name without change of development when they are imported into Lr.  Please help (PC user)

    And others have explained, Lightroom does not apply the changes to the file. All changes are stored in the catalog, and then applied to the image when it is displayed in Lightroom. If you want a copy of the image with any changes so that you can share with others or send it to a laboratory to print, then you must export a copy of this image by using the export dialog box in Lightroom.

    Features of Lightroom as well by its design. The images that you import are always left in their original condition, unmodified.

  • I signed up for the photos of 10 a month, and I chose pictures of licenses.  However, when I download the pictures I have a license on my desk always have the "stock" of writing through them.  How can I remove this?  Thank you

    I signed up for the photos of 10 a month, and I chose pictures of licenses.  However, when I download the pictures I have a license on my desk always have the "stock" of writing through them.  How can I remove this?  Thank you

    Follow these steps to download: I downloaded my 10 free images and they all have the Adobe watermark on them, so I can't use them. Why do they have a watermark on them?

  • I pay for the creative cloud for the Photo, but applications still saying, I have to buy, and the trial is over

    I pay for the creative cloud for the Photo, but applications still saying, that I have to buy, and the time of the trial is over

    Iron,

    Please see this link:

    https://helpx.Adobe.com/manage-account-membership/CC-reverts-to-trial.html

    Guinot

  • I ordered a student member, discount prepaid option yesterday and in the status of the order, it is said that they are waiting for the documentation. How do I provide this?

    I ordered a student member, discount prepaid option yesterday and in the status of the order, it is said that they are waiting for the documentation. How do I provide this?

    For more information about the provisions of the student/teacher, you can refer to the following information page:

    http://helpx.Adobe.com/x-productkb/policy-pricing/Education-FAQ.html#main_submit_poe

    Another good resource for information is the student and teacher edition information forum:

    http://forums.Adobe.com/community/download_install_setup/student_and_teacher_edition_infor mation_? view = discussions

    Here are some links about the Adobe student discount:
    http://www.Adobe.com/education/students.edu.html?showEduReq=Yes

    http://www.Adobe.com/education/student-eligibility-Guide.edu.html

    http://www.Adobe.com/education/students/how-to-buy-eligibility.edu.html

  • While trying to see Planner installation and operation, the test in local mode, the EXECUTION fails with message "Waiting for the number of virtual machines to register.

    While trying to see installation and operation Planner, the test in local mode with only 1 VM the EXECUTION fails with message "Waiting for the number of virtual machines to register.

    There may be a lot of problems in the desktop VM. Agent service see Planner is not running in VM Office. You can check in the event viewer to see what kind of error occurs. The most usual error missing file IP.txt c; drive or harness IP in the IP.txt produce if there is.

  • How can I export to PDF for printing Offset, including colors and grayscale of the photo?

    After reading dozens of forum, I not yet found the answer.

    I made a photo album with full-colur and b & w photos for Offset print. I want to be for the b & w grayscale avoid the hues of colors possible. It seems that InDesign does not support the shades of gray, how images become dark. Even with export without any conversion of color or the destination and/or including profiles of original colors, the images are exported to obscurity as a PDF to grayscale.


    How can I export to PDF for printing Offset, including colors and grayscale of the photo?

    Yes, Photoshop & ID CMYK working spaces are the same

    This can become difficult because 3 programs manage proofing differently.

    Work spaces don't matter, document profiles that handle the preview. So here's the same image in grayscale, placed in the ID on the top and PS on the bottom. I put my info in Photoshop to display the profile of doc in the lower left corner. I can see the profile of my InDesign CMYK Document in my test format (CMYK work is different and is not used). The two profiles are actually the same coated FOGRA39 (Black Ink FOGRA in the case of the PS).

    But the previews do not match because I disabled, so the preview InDesign is Gamma 2.2 or a "screen" media preview overprinting.

    If I turn on overprint preview, I get a match because I'm soft proofing for printing:

  • The class I'm teaching starts Monday and I can't wait for the return of my serial number snail mail. M

    The class I'm teaching starts Monday and I can't wait for the return of my serial number snail mail. My product code is < removed by mod, kglad >. What help can you give me?

    Contact adobe support, http://helpx.adobe.com/contact.html?product=flash&topic=using-my-product-or-service

  • How can I get the vi to wait for the user to select a COM port?

    It is a problem when I run the application.  If the selected COM port is not currently connected to the material, then I get an error.  I can then select the COM port, rerun the application and everything is fine.  But I want the application to run when it is called by the user and wait until the correct COM port is selected.  I'll settle for any COM port selection and put the responsibility for the adequate selection on the user.  Thank you all.

    Of course.  It works fine now.  Thanks MikeS81!

Maybe you are looking for