Android Open Source - HN Db Mgr






From Project

Back to project page HN.

License

The source code is released under:

Apache License

If you think the Android project HN 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

/*
 * Copyright 2014 Ye Lin Aung//from w w w .j  a  va 2 s  . c  om
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.yelinaung.hn.app.db;

import android.content.Context;
import com.j256.ormlite.android.apptools.OpenHelperManager;

/**
 * Created by Ye Lin Aung on 14/01/30.
 */
public class DbMgr {
  private DbHelper dbHelper = null;

  public DbHelper getHelper(Context context) {
    if (dbHelper == null) {
      dbHelper = OpenHelperManager.getHelper(context, DbHelper.class);
    }
    return dbHelper;
  }

  //releases the helper once usages has ended
  public void releaseHelper(DbHelper helper) {
    if (dbHelper != null) {
      OpenHelperManager.releaseHelper();
      dbHelper = null;
    }
  }
}




Java Source Code List

com.yelinaung.hn.app.db.DbHelper.java
com.yelinaung.hn.app.db.DbMgr.java
com.yelinaung.hn.app.db.StoryDao.java
com.yelinaung.hn.app.model.Story.java
com.yelinaung.hn.app.ui.MainActivity.java
com.yelinaung.hn.app.ui.StoryAdapter.java