Courtney Courtney - 4 months ago 7
Android Question

Why are Google's instructions for Material Design incorrect?

I have seen similar questions asked with solutions which solve my problem but I was wondering if anyone can explain it to me.

I am following instructions on the Google Developer website to apply the Material Design Theme located here. However, I am getting an

IllegalStateException
when I try to run the app on the emulator. My theme inherits from
parent="android:Theme.Material"
as specified in the instructions provided by Google.

The issue is solved by using
Theme.AppCompat
. Why is it that the instructions that Google provide leads to an error? I read that
Theme.AppCompat
extends
Theme.Material
, I don't know if that is true. Why can't Theme.Material cannot be used?

I tried following the line of extension for
Theme.AppCompat
but I didn't see it inherit from
Theme.Material
anywhere.

Answer

Why is it that the instructions that Google provide leads to an error?

The instructions assume that you are using Activity, not AppCompatActivity, as your base class for your activities. In your case, you are using AppCompatActivity.

I read that Theme.AppCompat extends Theme.Material, I don't know if that is true.

It is not true.