在 尝试执行此代码片段时,在url异常中没有':'获取该异常...
FileConnection conn;
try{
conn =(FileConnection)Connector.open("/NewFile.xml");
if(!conn.exists())
conn.create();
_screen.add(new RichTextField("Connection Established..."));
_screen.add(new SeparatorField());
} catch(IOException ioe) {
_screen.add(new RichTextField(ioe.getMessage()));
}
Run Code Online (Sandbox Code Playgroud)
其中/NewFile.xml是我的Project中的xml文件
你必须写出像这样的路径
文件:///NewFile.xml/
try{
conn =(FileConnection)Connector.open("file:///NewFile.xml/");
if(!conn.exists())
conn.create();
_screen.add(new RichTextField("Connection Established..."));
_screen.add(new SeparatorField());
}
catch(IOException ioe)
{
_screen.add(new RichTextField(ioe.getMessage()));
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1367 次 |
最近记录: |