Code example for AbstractPreferences

Methods: addPreferenceChangeListenerputIntremovePreferenceChangeListener

0
        mpcl.assertChanged(false);
    } 
 
    public void testRemovePreferenceChangeListener() throws Exception { 
        MockPreferenceChangeListener mpcl = new MockPreferenceChangeListener();
        parent.addPreferenceChangeListener(mpcl);
        mpcl.assertChanged(false);
        parent.putInt("IntValue", 33);
        mpcl.assertChanged(true);
        parent.removePreferenceChangeListener(mpcl);
        parent.putInt("IntValue", 33);
        mpcl.assertChanged(false);
    } 
 
    class MockNodeChangeListener implements NodeChangeListener {
        private boolean flagAdded = false;
        private boolean flagRemoved = false;
 
        public synchronized void childAdded(NodeChangeEvent arg0) {
            flagAdded = true;
Stop searching for code, let great code find you!  Add Codota to your java IDE