The crash "This Activity already has an action bar supplied by the window decor" happens because:

  1. The app has no internet
  2. Toast is called too often
  3. A theme with an ActionBar is used together with setSupportActionBar(toolbar)
  4. The menu XML is missing
Answer

C) A theme with an ActionBar is used together with setSupportActionBar(toolbar)

Use a NoActionBar theme when you set a Toolbar as the app bar.

Computer Science MCQ · More Lab: Menus and Messages MCQs · Practise