warning: [deprecation] getColor(int) in Resources has been deprecated

Reference:

https://developer.android.com/reference/android/content/res/Resources#getColor(int)https://developer.android.com/reference/android/content/res/Resources#getColor(int)

This method is deprecated from API level 23, so you can safely manage this situation with:

int MyColor=0;
if (Build.VERSION.SDK_INT >= 23) // the new version of the API
     myColor = getResources()
        .getColor(
            R.color.primaryColor, 
            getActivity.getTheme()
        )
     );
else  // the old version of the API
    myColor = getResources()
        .getColor(R.color.primaryColor));