Android Open Source - droidtv Preference Utils

From Project

Back to project page droidtv.


The source code is released under:

GNU General Public License

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

 *  DroidTV, live TV on Android devices with host USB port and a DVB tuner    *
 *  Copyright (C) 2012  Christian Ulrich <>                  *
 *                                                                            *
 *  This program is free software: you can redistribute it and/or modify      *
 *  it under the terms of the GNU General Public License as published by      *
 *  the Free Software Foundation, either version 3 of the License, or         *
 *  (at your option) any later version.                                       *
 *                                                                            *
 *  This program is distributed in the hope that it will be useful,           *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *  GNU General Public License for more details.                              *
 *                                                                            *
 *  You should have received a copy of the GNU General Public License         *
 *  along with this program.  If not, see <>.     *
// w  w  w  . ja va  2  s.c o m
package com.chrulri.droidtv.utils;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import com.chrulri.droidtv.PreferencesActivity;
import com.chrulri.droidtv.StreamActivity.DvbType;

public final class PreferenceUtils {
    static final String TAG = PreferenceUtils.class.getName();

    public static final String KEY_DVBTYPE = "dvbType";
    public static final String KEY_CHANNELCONFIGS = "channelConfigs";
    public static final String KEY_SCANCHANNELS = "scanChannels";

    public static SharedPreferences get(Context ctx) {
        return PreferenceManager.getDefaultSharedPreferences(ctx

     * @return read dvbType from preferences or return default (
     *         {@link DvbTuner.TYPE_DVBT})
    public static DvbType getDvbType(Context ctx) {
        String dvbType = get(ctx).getString(KEY_DVBTYPE, null);
        return Enum.valueOf(DvbType.class, dvbType);

    public static void openSettings(Context context) {
        Intent settingsActivity = new Intent(context, PreferencesActivity.class);

Java Source Code List