Chinaunix首页 | 论坛 | 博客
  • 博客访问: 12107
  • 博文数量: 5
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 0
  • 用 户 组: 普通用户
  • 注册时间: 2013-08-02 22:36
文章分类
文章存档

2015年(1)

2014年(3)

2013年(1)

我的朋友
最近访客

分类: 嵌入式

2014-12-24 14:51:59

try {
     InputStream in = mContext.getAssets().open("update_cities.sql");
     SQLiteDatabase database = getWritableDatabase();
     BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in));
     String sqlUpdate = null;
     while ((sqlUpdate = bufferedReader.readLine()) != null) {
           if (!TextUtils.isEmpty(sqlUpdate)) {
               database.execSQL(sqlUpdate);
           }
     }
     bufferedReader.close();
     in.close();
} catch (SQLException e) {
        XLog.log(TAG, e.getMessage());
} catch (IOException e) {
        XLog.log(TAG, e.getMessage());
}
阅读(662) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~