I'm getting color (i.e. R.color.my_white
is FFFFFFFF
) from my resource as below
ContextCompat.getColor(getContext(), R.color.my_white)
And when I perform AndroidJUnit4 testing, I also get the same color.
ContextCompat.getColor(getContext(), R.color.my_white)
However their return value differs, where in the actual activity, it is -1, and in the Instrumental Test, it is 520093696. Why is that differing?
(I suspect that the instrumental test context return a different result)
I found the way to do it. The
getContext()
in the AndroidJunit4 is not working correctly. So I useWhere
activityRule
is