Note that there are some explanatory texts on larger screens.

plurals
  1. POPreference selection always staying default
    primarykey
    data
    text
    <p>I am having a small problem, every time i try to change the preferences in my program they never change in the activity, they just stay at what the default is.</p> <pre><code>public class Reciever extends BroadcastReceiver { boolean smsOn = false; String smsColor = new String ("Green"); Uri smsSound; String smsVibrate = new String ("Normal"); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(arg0); smsOn = pref.getBoolean(Preferences."PREF_SMS_ON", false); smsColor = pref.getString(Preferences.SMS_PREF_COLOR, "Green"); smsSound = Uri.parse(pref.getString(Preferences.SMS_PREF_SOUND, "Silent")); smsVibrate = pref.getString(Preferences.SMS_PREF_SOUND, "Normal"); //all variable remain default value verified through debugger NotificationManager mNotificationManager = (NotificationManager) arg0.getSystemService(Context.NOTIFICATION_SERVICE); if (arg1.getAction().equals(ACTION)){ if(smsOn == true){....... if checkbox is checked smsOn still remains false } </code></pre> <p>prefenceactivity class</p> <pre><code>public class Preferences extends PreferenceActivity implements OnPreferenceClickListener{ public static final String PREF_SMS_ON = "PREF_SMS_ON"; public static final String VIBRATE_ON_CALL1 = "VIBRATE_ON_CALL1"; public static final String SMS_PREF_COLOR = "SMS_PREF_COLOR"; public static final String SMS_PREF_SOUND = "SMS_PREF_SOUND"; public static final String SMS_PREF_VIB = "SMS_PREF_VIB"; } </code></pre> <p>xml file(i will just copy one)</p> <pre><code> &lt;CheckBoxPreference android:key="PREF_SMS_ON" android:title="SMS Notifications" android:summary="Turn On SMS Notifications" android:defaultValue="false"&gt; &lt;/CheckBoxPreference&gt; </code></pre> <p>i dont understand what it wrong, it all looks like it should work to me</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload