显示包含PDF链接的空白页

时间:2018-07-01 23:38:11

标签: codenameone

Android OS版本7.1.1,以下代码在下载该应用程序后首次显示空白屏幕。必须终止该应用程序,然后再次打开它才能正常工作。请告知。

enter image description here

代码:

Container cc = new Container(BoxLayout.y());
cc.setScrollableY(true);
TextArea ta = new TextArea(Util.readToString(is));
ta.setEditable(false);
ta.setUIID("Label");    
Button b = new Button("Terms of Service");
b.addActionListener(e3 -> {
try {
FileSystemStorage fs = FileSystemStorage.getInstance();
final String homePath = fs.getAppHomePath();
String fileName = homePath + "Terms of Service.pdf";
Util.copy(Display.getInstance().getResourceAsStream(getClass(), "/Terms of Service.pdf"), fs.openOutputStream(fileName));
Display.getInstance().execute(fileName);
} catch (IOException ex) {
}
});
cc.add(ta);
CheckBox rememberMe1 = new CheckBox();
rememberMe1.setSelected(false);
rememberMe1.setHeight(Display.getInstance().convertToPixels(10.0f));
rememberMe1.setAutoSizeMode(true);   
b.setAutoSizeMode(true);
setSameHeight(rememberMe1, l11, b); 
cc.add(FlowLayout.encloseIn(rememberMe1, b));

0 个答案:

没有答案