Back to project page MinerStatus.
The source code is released under:
Apache License
If you think the Android project MinerStatus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package me.davidgreene.minerstatus.service; /*from w ww . j a va 2 s. c om*/ import me.davidgreene.minerstatus.MinerStatusApp; import me.davidgreene.minerstatus.theme.Theme; import me.davidgreene.minerstatus.theme.ThemeFactory; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class ThemeServiceImpl implements ThemeService { private MinerStatusApp app; public ThemeServiceImpl(Context context){ this.app = ((MinerStatusApp)context); } private final String SELECT_CONFIG_VALUE = "select value from config where key=?"; public Theme getTheme() { Cursor cursor = null; try{ cursor = getDBr().rawQuery(SELECT_CONFIG_VALUE, new String[]{"theme"}); if (cursor.moveToNext()){ return ThemeFactory.getTheme(cursor.getString(0)); } else { return ThemeFactory.getTheme(); } } catch (Exception e){ return ThemeFactory.getTheme(); } finally{ if (cursor != null){ cursor.close(); } } } private SQLiteDatabase getDBr(){ return app.getDbHelper().getReadableDatabase(); } }