Buggy code:
public class TriggerEditActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener { private static boolean preferencesChanged = false ; private static CharSequence [ ] profileArray ; private static String previousName ; ColorFilter filter ; @ Override protected void onCreate ( Bundle savedInstanceState ) { SharedPreferences pref = PreferenceManager . getDefaultSharedPreferences ( this ) ; changeTheme ( pref ) ; super . onCreate ( savedInstanceState ) ; getActionBar ( ) . setTitle ( trigger_edit_title ) ; getActionBar ( ) . setDisplayHomeAsUpEnabled ( true ) ; getFragmentManager ( ) . beginTransaction ( ) . replace ( content , new TriggerEditActivity . MyPreferenceFragment ( ) ) . commit ( ) ; refreshProfileArray ( ) ; } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } private void changeTheme ( SharedPreferences pref ) { } public static class MyPreferenceFragment extends PreferenceFragment implements OnSharedPreferenceChangeListener { @ Override public void onCreate ( final Bundle savedInstanceState ) { SharedPreferences pref = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; <START_BUG> TriggerEditActivity . previousName = pref . getString ( "name" , "default<seq2seq4repair_space>name" ) ; <END_BUG> pref . registerOnSharedPreferenceChangeListener ( this ) ; super . onCreate ( savedInstanceState ) ; addPreferencesFromResource ( pref_trigger_edit_general ) ; TriggerEditActivity . bindPreferenceSummaryToValue ( findPreference ( "name_trigger" ) ) ; TriggerEditActivity . bindPreferenceSummaryToValue ( findPreference ( "profile" ) ) ; TriggerEditActivity . bindPreferenceSummaryToValue ( findPreference ( "priority" ) ) ; ListPreference lp = ( ( ListPreference ) ( findPreference ( "profile" ) ) ) ; lp . setEntries ( TriggerEditActivity . profileArray ) ; lp . setEntryValues ( TriggerEditActivity . profileArray ) ; TriggerEditActivity . bindPreferenceSummaryToValue ( findPreference ( "profile" ) ) ; addPreferencesFromResource ( pref_trigger_edit_location ) ; TriggerEditActivity . bindPreferenceSummaryToValue ( findPreference ( "location" ) ) ; addPreferencesFromResource ( pref_trigger_edit_time ) ; TriggerEditActivity . bindPreferenceSummaryToValue ( findPreference ( "start_time" ) ) ; TriggerEditActivity . bindPreferenceSummaryToValue ( findPreference ( "end_time" ) ) ; addPreferencesFromResource ( pref_trigger_edit_battery ) ; TriggerEditActivity . bindPreferenceSummaryToValue ( findPreference ( "battery_state" ) ) ; addPreferencesFromResource ( pref_trigger_edit_headphone ) ; TriggerEditActivity . bindPreferenceSummaryToValue ( findPreference ( "headphone" ) ) ; if ( ( pref . getInt ( "geofence_radius" , 50 ) ) > 0 ) { findPreference ( "location" ) . setSummary ( ( ( ( ( ( ( ( ( ( ( ( ( getString ( trigger_pref_location_lat ) ) + ":<seq2seq4repair_space>" ) + ( pref . getFloat ( "geofence_lat" , 0.0F ) ) ) + "°,<seq2seq4repair_space>" ) + ( getString ( trigger_pref_location_lng ) ) ) + ":<seq2seq4repair_space>" ) + ( pref . getFloat ( "geofence_lng" , 0.0F ) ) ) + "°,<seq2seq4repair_space>" ) + ( getString ( trigger_pref_location_radius ) ) ) + ":<seq2seq4repair_space>" ) + ( pref . getInt ( "geofence_radius" , 50 ) ) ) + "m" ) ) ; } else { findPreference ( "location" ) . setSummary ( ignored ) ; } if ( pref . getString ( "start_time" , getString ( ignored ) ) . equals ( getString ( ignored ) ) ) { findPreference ( "end_time" ) . setEnabled ( false ) ; pref . edit ( ) . putString ( "end_time" , getString ( ignored ) ) . apply ( ) ; } if ( ! ( pref . getBoolean ( "battery_level_check" , false ) ) ) { pref . edit ( ) . putInt ( "battery_start_level" , ( - 1 ) ) . apply ( ) ; findPreference ( "battery_start_level" ) . setEnabled ( false ) ; findPreference ( "battery_start_level" ) . setSummary ( getString ( ignored ) ) ; } else if ( pref . getBoolean ( "battery_level_check" , false ) ) { findPreference ( "battery_start_level" ) . setEnabled ( true ) ; } if ( ( pref . getInt ( "battery_start_level" , ( - 1 ) ) ) == ( - 1 ) ) { findPreference ( "battery_end_level" ) . setEnabled ( false ) ; pref . edit ( ) . putInt ( "battery_end_level" , ( - 1 ) ) . apply ( ) ; } int size = pref . getStringSet ( "weekdays" , null ) . size ( ) ; if ( pref . getStringSet ( "weekdays" , null ) . isEmpty ( ) ) { findPreference ( "weekdays" ) . setSummary ( trigger_pref_weekday_none ) ; } else if ( size == 7 ) { findPreference ( "weekdays" ) . setSummary ( trigger_pref_weekday_all ) ; } else if ( ( ( ( ( ( size == 5 ) && ( pref . getStringSet ( "weekdays" , null ) . contains ( "1" ) ) ) && ( pref . getStringSet ( "weekdays" , null ) . contains ( "2" ) ) ) && ( pref . getStringSet ( "weekdays" , null ) . contains ( "3" ) ) ) && ( pref . getStringSet ( "weekdays" , null ) . contains ( "4" ) ) ) && ( pref . getStringSet ( "weekdays" , null ) . contains ( "5" ) ) ) { findPreference ( "weekdays" ) . setSummary ( trigger_pref_weekday_weekdays ) ; } else if ( ( ( size == 2 ) && ( pref . getStringSet ( "weekdays" , null ) . contains ( "6" ) ) ) && ( pref . getStringSet ( "weekdays" , null ) . contains ( "7" ) ) ) { findPreference ( "weekdays" ) . setSummary ( trigger_pref_weekday_weekend ) ; } else { StringBuilder summary = new StringBuilder ( ) ; int i = 1 ; if ( pref . getStringSet ( "weekdays" , null ) . contains ( "1" ) ) { summary . append ( getResources ( ) . getString ( trigger_pref_mon ) ) ; if ( i < ( size - 1 ) ) { summary . append ( ",<seq2seq4repair_space>" ) ; i ++ ; } else if ( i == ( size - 1 ) ) { summary . append ( "<seq2seq4repair_space>" ) . append ( getResources ( ) . getString ( trigger_pref_and ) ) . append ( "<seq2seq4repair_space>" ) ; i ++ ; } }

Fix:
TriggerEditActivity . previousName = pref . getString ( "name_trigger" , "default<seq2seq4repair_space>name" ) ;