Hi, I replied to an email from Steve about my original thread regarding 
this but didn't see this reply on the original message thread so thought 
I'd re-paste it here just in case. 

I have done some further investigating and created a small demo app rather 
than using the photos within my own code. I have a very simple app with a 
single class - I have pasted the class code below. I can't really create an 
app for you to run as it's apple so had to build it with my own 
certificate/provisioning profile etc.

I have a button which calls Capture.capturePhoto(); and does nothing else. 
As it is difficult to see if the app has restarted, in the init() method I 
have a label which logs the current UTC Time.

Upon running it, if I do not press the button I can go back to home screen, 
restart the app and the time displayed does not change, ie it has not 
restarted. If I take a photo, come back to the form, then even just press 
the home button then open the app again the time displayed has changed, the 
application has crashed and restarted

This is obviously more noticeable in my real app as the user gets the 
splash screen back and has to log in again and will have lost any unsaved 
work.

The sample code to test this is :-

public class MyApplication {

    private Form current;
    private Resources theme;

    public void init(Object context) {
        theme = UIManager.initFirstTheme("/theme");

        // Enable Toolbar on all Forms by default
        Toolbar.setGlobalToolbar(true);

        // Pro only feature, uncomment if you have a pro subscription
        // Log.bindCrashProtection(true);
       
        Form hi = new Form("Welcome", new 
BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));
        final Label apple = new Label(theme.getImage("apple-icon.png"));
        final Label android = new Label(theme.getImage("android-icon.png"));
        final Label windows = new Label(theme.getImage("windows-icon.png"));
      
 
        Calendar cal = Calendar.getInstance();
        long time = cal.getTime().getTime();
        Label l = new Label("Time start is " + time);
        Button b1 = new Button("Take a Photo");
        b1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final String photoPath = Capture.capturePhoto();
               
            }
        });
        hi.addComponent(BorderLayout.NORTH, l);
        hi.addComponent(BorderLayout.CENTER, b1);
        hi.show();
    }
   
    public void start() {
       
    }

    public void stop() {
        current = Display.getInstance().getCurrent();
        if(current instanceof Dialog) {
            ((Dialog)current).dispose();
            current = Display.getInstance().getCurrent();
        }
    }
   
    public void destroy() {
   
    }

}

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/0becf212-9336-4c6b-9fee-93940a04a20d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to