Skip to content

Commit

Permalink
Fix SwitchPreference crashing the app
Browse files Browse the repository at this point in the history
  • Loading branch information
vainamov committed May 15, 2019
1 parent 4d88bef commit 6dabb56
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -11,7 +11,7 @@ import android.widget.Toast

class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener {
override fun onCreatePreferences(p0: Bundle?, p1: String?) {
addPreferencesFromResource(edu.festival.deichkind.R.xml.app_resources)
addPreferencesFromResource(R.xml.app_resources)

(activity as AppCompatActivity).supportActionBar?.setTitle(R.string.settings_title)

Expand All @@ -23,8 +23,8 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP

if (preference is ListPreference) {
preference.summary = preference.entry
}

Toast.makeText(activity, "Changed " + key + " to: " + (preference as ListPreference).entry, Toast.LENGTH_LONG).show()
Toast.makeText(activity, "Changed " + key + " to: " + (preference as ListPreference).entry, Toast.LENGTH_LONG).show()
}
}
}

0 comments on commit 6dabb56

Please sign in to comment.