1.數(shù)據庫的操作類型有哪些
這個,有點不明白題目的意思
感覺答案可能會是:
**create insert update delete select drop **
2.如何導入外部數(shù)據庫
數(shù)據庫本質就是文件
android系統(tǒng)下數(shù)據庫應該存放在 /data/data/com..(package name)/ 目錄下
所以導入數(shù)據庫其實就是文件的復制操作
用到的就是文件流FileInputStream,熟悉java的話可以輕松的完成文件的復制
if(!(newFile(dbfile).exists())) {
InputStream is =this.context.getResources().openRawResource(R.raw.countries);
//此處raw下的文件為欲導入的數(shù)據庫,提前保存在工程目錄下
FileOutputStream fos =newFileOutputStream(dbfile);
byte[] buffer =newbyte[BUFFER_SIZE];
int count =0;
while((count = is.read(buffer)) >0) {
fos.write(buffer,0, count);
}
fos.close();
is.close();
}