0
我想推動屏幕上的主要UiApplication(MyApp)基於任一數據庫創建或不創建,如果它創建比它是emapty或是它有一些數據.. 但是當我運行這段代碼我balckberry應用jsts掛..基於sqlite數據庫中的數據推動黑莓UI應用程序的屏幕上的問題
任何幫助表示讚賞:)
我已經檢查了虛擬SD卡有在模擬器和我甚至碼在運行時檢查SDCard是否可用。
JDE 6.0版的Eclipse赫利俄斯
插上黑莓模擬器: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();
}
}
如果你註釋掉MyApp中的所有代碼,只留下'pushScreen(new Settings())'行,那麼它是否工作? – 2011-04-21 09:33:34