Android Open Source - cnBeta Base D B

From Project

Back to project page cnBeta.


The source code is released under:

Apache License

If you think the Android project cnBeta listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.guest.cnbeta.database;
/*from  ww  w .  j  a  v a2  s .  com*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

public class BaseDB {

  private BaseDBHelper dbHelper;
  protected SQLiteDatabase db;

  public BaseDB(Context context) {
    if (dbHelper == null) {
      dbHelper = new BaseDBHelper(context, "db.db", null, 1);
    if (db == null) {
      db = dbHelper.getWritableDatabase();
    }else {

  protected String toSafeString(String str) {

    try {
      str = str.replace("'", "''");
    } catch (NullPointerException e) {
      // TODO: handle exception

    return str;

Java Source Code List