By adding resource annotation to Android argument, it can be verified whether it exists in the resource.
before
private void handleColorChange(int stringResId, int colorResId) {
int prefColor = pref.getInt(getString(stringResId), 0);
...
}
after
private void handleColorChange(@StringRes int stringResId, @ColorRes int colorResId) {
int prefColor = pref.getInt(getString(stringResId), 0);
...
}
Android Studio will tell you as follows.
Wrong
Positive