BrowserComponent不适用于CodenameOne 3.7.2吗?

时间:2017-07-17 09:12:25

标签: codenameone

以下代码在模拟器中不起作用(在NetBeans 8.2 + CodenameOne 3.7.2 + Skin Iphone3gs上)并且在我的Android 4.1.2设备中不起作用。它会阻止模拟器,它会在真实设备上显示一个空白屏幕(闪烁"正在加载......")。问题是什么?谢谢

import static com.codename1.ui.CN.*;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Dialog;
import com.codename1.ui.Label;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import com.codename1.io.Log;
import com.codename1.ui.BrowserComponent;
import com.codename1.ui.Toolbar;
import com.codename1.ui.layouts.BorderLayout;
import java.io.IOException;
import com.codename1.ui.layouts.BoxLayout;

/**
 * This file was generated by <a href="https://www.codenameone.com/">Codename One</a> for the purpose 
 * of building native mobile applications using Java.
 */
public class Gmail {

    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
        Log.bindCrashProtection(true);
    }

    public void start() {
        if(current != null){
            current.show();
            return;
        }
        Form hi = new Form("Form title Example", new BorderLayout());
        BrowserComponent browser = new BrowserComponent();
        browser.setURL("https://students.uninettunouniversity.net/");
        hi.add(BorderLayout.CENTER, browser);
    }

    public void stop() {
        current = getCurrentForm();
        if(current instanceof Dialog) {
            ((Dialog)current).dispose();
            current = getCurrentForm();
        }
    }

    public void destroy() {
    }

}

1 个答案:

答案 0 :(得分:1)

您最后删除了hi.show()