Check that the tools tag in the xml file is linked to the correct class. tools:context=".YourJavaClass">