PreferenceActivity and BroadcastReceiver - Implement dynamic preferences
<p>I'm going by the following code example to dynamically build a preference activity.</p>

<p><a href="http://www.linuxtopia.org/online_books/android/devguide/guide/samples/ApiDemos/src/com/example/android/apis/app/PreferencesFromCode.html" rel="nofollow">http://www.linuxtopia.org/online_books/android/devguide/guide/samples/ApiDemos/src/com/example/android/apis/app/PreferencesFromCode.html</a></p>

<p>The preference dialog shows, but I'm not able to see any changes after closing it.</p>

<p>Here's where I'm defining the activity in AndroidManifest.xml</p>

<pre><code>    &lt;activity 
          android:name="PreferencesActivity" android:label="@string/preferences_name"&gt;
    &lt;/activity&gt;
</code></pre>

<p>Here's where I'm defining the receiver.</p>

<pre><code>    &lt;receiver
            android:name="FroyVisualReceiver"
            android:label="@string/app_name"
            android:exported="false"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="com.starlon.froyvisuals.PREFS_UPDATE"/&gt;
            &lt;/intent-filter&gt;
    &lt;/receiver&gt;
</code></pre>

<p>And here's the BroadcastReceiver. I never see the "WTF" in logcat. What am I doing wrong?</p>

<pre><code>package com.starlon.froyvisuals;

import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.Context;
import android.util.Log;

public class FroyVisualsReceiver extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        Log.e("WTFWTF", "WTFWTFWTFW");
        String action = intent.getAction();
        if(action.equals("com.starlon.froyvisuals.PREFS_UPDATE"))
        {
            ((FroyVisuals)context).updatePrefs();
        }
    }
}
</code></pre>

<p>Oh here's onPause where I'm broadcasting the PREFS_UPDATE intent.I do see the logcat message. This method is part of my PreferenceActivity.</p>

<pre><code>    /** another activity comes over this activity */
    @Override
    public void onPause()
    {
        Log.i(TAG, "onPause ================================ ");
        super.onPause();
        Intent i = new Intent(this, FroyVisualsReceiver.class);
        i.setAction("com.starlon.froyvisuals.PREFS_UPDATE");
        sendBroadcast(i);
    }
</code></pre>

<p>Edit: I think it may have to do with this line. 'this' points to my PreferenceActivity.</p>

<pre><code>Intent i = new Intent(this, FroyVisualsReceiver.class);
</code></pre>
