in my app i am trying to fetch some data from database and i am showing it in a list. When i run the app in my Motorola(2.1) and in Samsung Ace(2.3) and i some of my emulators t
public class BaseDAO extends OrmLiteSqliteOpenHelper {
public static Dao, Integer> instanseDao(Context cont, Class c,String Dbname) {
File path=new File(DATABASE_PATH);
File f = new File(DATABASE_PATH+DB_NAME);//改默认数据库目录需先手动创建数据库文件
if (!path.exists()) {
path.mkdirs();// 创建一个目录
}
if (!f.exists()) {
try {
f.createNewFile();//创建文件
} catch (IOException e) {
e.printStackTrace();
}
}
//how do??????
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(f,null);//创建数据库实例
BaseDAO baseDAO = new BaseDAO(cont);
//baseDAO.onCreate(db);
//baseDAO.onUpgrade(db,baseDAO.getConnectionSource(), OLD_DB_VERSION, DB_VERSION);
//baseDAO.close();//注意要先关掉
//db =SQLiteDatabase.openDatabase(DATABASE_PATH+DB_NAME, null, SQLiteDatabase.CREATE_IF_NECESSARY);
try {
Dao = baseDAO.getDao(c);
} catch (SQLException e) {
e.printStackTrace();
}
CONT=cont;
C=c;
DB_NAME = Dbname;
return Dao;
}