该
onCreate不是数据库类的构造函数。仅当您尝试打开不存在的数据库时才调用它。要打开/创建数据库,您需要添加对以下方法之一的调用:
public class SmartApp extends Activity implements onSharedPreferenceChangeListener { private SmartDBHelper dBHelper; public void onCreate(Bundle savedInstanceState) { //where i am wanting to create the database and tables dBHelper = new SmartDBHelper(getContext()); // open to read and write dBHelper.getWritableDatabase(); // or to read only // dBHelper.getReadableDatabase(); }}它有点大,但是这是我的DatabaseAdapter,您可以看一下:http
:
//saintfeintcity.org/projects/sfc/repository/entry/trunk/src/org/saintfeintcity/database/GameDbAdapter.java



