sqlite小型数据库,在开发的时候用于保存数据,在这不做关于它的介绍,本文只是写出了怎么拷贝应用的数据到本地sd卡中。如:一个数据库名为dandy.db的,拷贝到本地中叫seeker.db
代码如下:
| 代码如下 | 复制代码 |
/** * 拷贝数据库到sd卡 * * @deprecated */ publicstaticvoidcopyDataBaseToSD(){ if(!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { return; } File dbFile =newFile(MvpApplication.getApplication().getDatabasePath("dandy")+".db"); File file =newFile(Environment.getExternalStorageDirectory(),"seeker.db");
FileChannel inChannel =null,outChannel =null;
try{ file.createNewFile(); inChannel =newFileInputStream(dbFile).getChannel(); outChannel =newFileOutputStream(file).getChannel(); inChannel.transferTo(0, inChannel.size(), outChannel); }catch(Exception e) { LogUtils.e(TAG,"copy dataBase to SD error."); e.printStackTrace(); }finally{ try{ if(inChannel !=null) { inChannel.close(); inChannel =null; } if(outChannel !=null){ outChannel.close(); outChannel =null; } }catch(IOException e) { LogUtils.e(TAG,"file close error."); e.printStackTrace(); } } } | |
《黎明杀机》开发商正开发新的《Serious Sam》游戏 由Devolver发行
超英派遣中心即将登陆Xbox Play Anywhere 深入了解这款独特而备受喜爱的冒险游戏
在《Hunter: The Reckoning – Deathwish》中怎么从猎物蜕变为猎手
《The Expanse: Osiris Reborn》——深入了解玩法 新同伴 封闭测试及发行窗口
Alien Deathstorm 科幻生存与动作结合 打造全新第一人称恐怖混合体验
宝可梦公司已在考虑未来可用口袋妖怪总数达到“或许一万只”
幸存者村庄2
怪可爱的店折相思菜单
怪可爱的店折相思菜单是一款画风治愈的模拟经营佳作,内置折相思菜单解锁多项便利功能
lol电竞经理人手游
lol电竞经理人手游让你可以成为职业的电竞经理人,在游戏中掌控游戏的走向!豪华阵
梦幻奶茶屋小游戏
梦幻奶茶屋是一款主打温馨治愈氛围的休闲经营作品,玩家将化身元气满满的奶茶店店长,
萌宠养成物语无限金币版
萌宠养成物语无限金币版是一款治愈系模拟养成游戏,以可爱卡通画风构建温馨虚拟世界,