private void copyDB(){
File dbFile = new File(Environment.getDataDirectory().getAbsolutePath()+"/data/com.example.main/databases/mydb.db");
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(dbFile);
fos = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath()+"/copy.db");
int len = 0;
byte[] buffer = new byte[2048];
while(-1!=(len=fis.read(buffer))){
fos.write(buffer, 0, len);
}
fos.flush();
} catch (Exception e) {
e.printStackTrace();
}finally{
try{
if(fos!=null)fos.close();
if (fis!=null)fis.close();
}catch(IOException e){
e.printStackTrace();
}
}
}