Why is my onSharedPreferenceChangeListener being called multiple times when I change a pref.
        Posted  
        
            by brockoli
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by brockoli
        
        
        
        Published on 2010-05-31T17:54:10Z
        Indexed on 
            2010/06/13
            16:42 UTC
        
        
        Read the original article
        Hit count: 308
        
I've written an app with 3 tabs. Each tab has the same list view with different data sources. I have setup SharedPreferences in the tabhost activity, but I put my onSharedPreferenceChangeListener method in my listactivity. When I change a preference, my listener gets called and it updates my database. This is all working. However, if I change the data in tab 1, it calls my listener once. If I change the data for tab 2 it calls it twice and if I change the data in tab 3 it calls it three times. Any idea why it works this way? I guess I could setup my shared prefs in my listactivity and that might avoid the issue, but I'm curious why my listener is called multiple times if it's in a different tab.
brockoli
© Stack Overflow or respective owner