Make sure your activity extends from AppCompatActivity. If you have an old project, it is probably using Activity.