您好,我在下面的 andorid 上创建了一个数据库类。
public class Veritabani extends SQLiteOpenHelper {
private static final String Veritabani_Adi = "Veritabanim";
private static final int Veritabani_Version = 1;
public Veritabani(Context context) {
super(context, Veritabani_Adi, null, Veritabani_Version);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE ARKTABLE (id INTEGER PRIMARY KEY AUTOINCREMENT , ad TEXT, soyad TEXT);");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXIST OperatorTablosu");
onCreate(db);
}
}
**then i declare may Veritabani class in my activity as below.**
public class DictionaryActivity extends Activity {
Spinner spnLanguage;
Veritabani objdb;;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dictionary);
spnLanguage=(Spinner)findViewById(R.id.spnLanguage);
objdb=new Veritabani(this);
spinnerfill();
}
我在 logcate 或控制台上没有异常。但是当我查看可能 data/data/myappp/ 时,我没有看到数据库目录。
我用的是安卓2.2版本