- // Get a handle for the shared preferences.
- SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
-
- // Get the theme preferences.
- boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
-
- // Set the delete icon according to the theme.
- if (darkTheme) {
- DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_dark);
- } else {
- DomainsActivity.deleteMenuItem.setIcon(R.drawable.delete_light);
- }