I am passing my custom object sub
which has a color property from an activity to another and retrieving it like this:
val intent = this.intent
val bundle = intent.extras
sub = bundle.getParcelable("selected")
then, when a button is pressed a color picker shows up and lets me select a color, I have this method that listens for the color selection:
override fun onColorSelected(dialogId: Int, color: Int) {
sub.color = color
createsub_rel.backgroundColor = color
}
as you can see the color is returned as an Int.
The Exceptions happens in the onBindViewHolder()
of my RecyclerView, specifically on this line:
viewHolder.relativeLayout.setBackgroundColor(mContext.getColor(sub.color))
the log states:
android.content.res.Resources$NotFoundException: Resource ID #0x7fff9800
I have debugged it and sub.color
is actually the expected value, I have looked here on SO for a solution, specifically on this, but I couldn't find any working answer.