public void imporDatabase() {
//存放数据库的目录
String dirPath="/data/data/com.hkx.wan/databases";
File dir = new File(dirPath);
if(!dir.exists()) {
dir.mkdir();
}
//数据库文件
File file = new File(dir, "abc.db");
try {
if(!file.exists()) {
file.createNewFile();
}
//加载需要导入的数据库
InputStream is = this.getApplicationContext().getResources().openRawResource(R.raw.db_weather);
FileOutputStream fos = new FileOutputStream(file);
byte[] buffere=new byte[is.available()];
is.read(buffere);
fos.write(buffere);
is.close();
fos.close();
}catch(FileNotFoundException e){
e.printStackTrace();
}catch(IOException e) {
e.printStackTrace();
}
}