Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1011766
  • 博文数量: 146
  • 博客积分: 3444
  • 博客等级: 中校
  • 技术积分: 1602
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-21 15:18
文章分类

全部博文(146)

文章存档

2014年(9)

2013年(3)

2012年(6)

2011年(44)

2010年(38)

2009年(46)

分类: 嵌入式

2011-12-12 10:00:03

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());
}
阅读(7945) | 评论(1) | 转发(1) |
给主人留下些什么吧!~~

fenglqc2012-12-19 10:17:44

我android2.3.3的项目,怎么提示没有getWritableDatabase()方法啊?请教。