0
应用程序使用存储在资产中的数据库。 完美的作品在Android 2.2 我添加了一些谷歌地图代码,所以我从Android 2.2的改变GoogleAPIs 2.2槽 项目 - >属性 - > android->项目建设目标出发,包含MySQLiteHelper指针活动后使用SQLiteHelper和Google Maps时应用程序崩溃
现在应用程序崩溃与
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.etf.db/com.etf.db.TabContainer}:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.etf.db/com.etf.db.QueryTab}:
android.database.sqlite.SQLiteException: no such table: stations: , while compiling: (some query)
当删除所有MySQLiteHelper指针时,没有RuntimeExceptions。
你的数据库有“站”表吗? – 2012-04-06 12:30:28
你的数据库如何存储在资产中? – dldnh 2012-04-06 13:05:12
我创建了myDatabase.db并将其放置到assets文件夹中。 'private void copyDataBase()throws IOException {InputSource myInput = myContext.getAssets()。open(DATABASE_NAME); String outFileName = DATABASE_PATH + DATABASE_NAME; myOutput = new FileOutputStream(outFileName); byte [] buffer = new byte [1024]; int length; ((length = myInput.read(buffer))> 0){ myOutput.write(buffer,0,length); } myOutput.flush(); myOutput.close(); myInput.close(); }' 在创建数据库我叫copyDataBase() – 2012-04-06 13:30:10