Since I'm building this with the v21 syupport library, I can use the SwitchCompat from the v7 appcompat library
Added null pointer check