Operator == cannot be applied to 'Long' and 'Int' in Kotlin

Simply use long on your right side

if (drawerItem.identifier == 1L)

Edit: the reason this is required is that Kotlin does not promote Ints to Longs (or, more generally, does not widen types); on the left side we had a Long and on the right side we had an Int, which lead to the error. Explicitly indicating that the right side is a Long fixes the error.


For interest, another solution would be to use compareTo(). compareTo returns zero if the values are equal, negative if its less than the other, or positive if its greater than the other:

 if(drawerItem.identifier.compareTo(1) == 0)   "Equals"