我正在尝试将屏幕推送到可能的主 UiApplication (MyApp) 上,具体取决于是否创建了数据库,如果它创建的不是 emapty 或者它是否有一些数据.. 但是当我运行此代码时,我的 balckberry 应用程序 jsts 挂起..
任何帮助表示赞赏:)
我已经检查了虚拟 SDCard 是否存在于模拟器中,我什至有代码可以在运行时检查 SDCard 是否可用。
带有 Eclipse Helios 的 JDE 版本 6.0
插入黑莓模拟器:9800
操作系统:windows 7 32 位终极版
下面是我在我的应用程序中使用的代码
public MyApp()
{
try {
MyAppURI = URI.create("file:///SDCard/BlackBerry/Database/"
+ "MyApp.db");
this.setMyURI(MyAppURI);
boolean flag = false;
flag = DatabaseFactory.exists(getMyURI());
if ( flag == false){
db = DatabaseFactory.create(getMyURI());
db.close();
new DatabaseSchema(); // this will simpaly create setting table in databse MyApp.db i am closing the database there
pushScreen(new Settings());
}else{
db = DatabaseFactory.open(getMyURI());
Statement st = db.createStatement("select count(*) from Setting");
Cursor cursor = st.getCursor();
if (cursor.isEmpty() == true){
pushScreen(new Settings());
}else{
pushScreen(new Reports());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}