Back to project page cicada.
The source code is released under:
Apache License
If you think the Android project cicada 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 org.cicadasong.samples.tubestatus; /*from w w w . j a va2 s.c o m*/ import android.content.Context; import android.content.SharedPreferences; public class Preferences { public static final String PREFS_NAME = "TubeStatusPreferences"; private Preferences() {} public static SharedPreferences getSharedPreferences(Context context) { return context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); } public static String getPreferredLine(Context context) { SharedPreferences prefs = getSharedPreferences(context); return prefs.getString("PreferredLine", context.getString(R.string.preferred_line)); } /** * @return value in minutes */ public static int getUpdateFrequency(Context context) { SharedPreferences prefs = getSharedPreferences(context); int frequency = Integer.parseInt(context.getString(R.string.update_frequency)); try { frequency = Integer.parseInt(prefs.getString("UpdateFrequency", Integer.toString(frequency))); } catch (NumberFormatException e) { } return frequency; } }