Reputation: 306
I'm having issue with the rotation from portrait to landscape mode on my app that I'm working on right now. The app lunches ok but when i rotate my phone or emulator I'm experiencing the problem. [
This is the error that I get when rotate from one mode to another.
Failed to inflate ColorStateList, leaving it to the framework java.lang.RuntimeException: Failed to resolve attribute at index 0 at android.content.res.TypedArray.getColor(TypedArray.java:402) at android.support.v7.content.res.AppCompatColorStateListInflater.inflate(AppCompatColorStateListInflater.java:114) at android.support.v7.content.res.AppCompatColorStateListInflater.createFromXmlInner(AppCompatColorStateListInflater.java:88) at android.support.v7.content.res.AppCompatColorStateListInflater.createFromXml(AppCompatColorStateListInflater.java:67) at android.support.v7.content.res.AppCompatResources.inflateColorStateList(AppCompatResources.java:116) at android.support.v7.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:74) at android.support.v7.widget.TintTypedArray.getColorStateList(TintTypedArray.java:170) at android.support.v7.widget.AppCompatTextHelper.onSetTextAppearance(AppCompatTextHelper.java:296) at android.support.v7.widget.AppCompatTextView.setTextAppearance(AppCompatTextView.java:162) at android.support.v4.widget.TextViewCompat$TextViewCompatBaseImpl.setTextAppearance(TextViewCompat.java:155) at android.support.v4.widget.TextViewCompat.setTextAppearance(TextViewCompat.java:476) at android.support.design.widget.TextInputLayout.setErrorEnabled(TextInputLayout.java:634) at com.jovan.matetracker.LoginActivity$2.onTextChanged(LoginActivity.java:68) at android.widget.TextView.sendOnTextChanged(TextView.java:8126) at android.widget.TextView.setText(TextView.java:4323) at android.widget.TextView.setText(TextView.java:4169) at android.widget.EditText.setText(EditText.java:85) at android.widget.TextView.setText(TextView.java:4144) at android.widget.TextView.onRestoreInstanceState(TextView.java:4044) at android.view.View.dispatchRestoreInstanceState(View.java:14141) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3089) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3089) at android.support.design.widget.TextInputLayout.dispatchRestoreInstanceState(TextInputLayout.java:1040) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3089) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3089) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3089) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3089) at android.view.View.restoreHierarchyState(View.java:14119) at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2220) at android.app.Activity.onRestoreInstanceState(Activity.java:1086) at android.app.Activity.performRestoreInstanceState(Activity.java:1027) at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1174) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2668) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769) at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4378) at android.app.ActivityThread.access$1000(ActivityThread.java:177) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1436) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5910) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Upvotes: 0
Views: 157
Reputation: 148
This problem may be occuring when there is a change in state in the Activity lifecycle. When you change the orientation, landscape to portrait or vise versa, the Activity is destroyed and created again.
More specifically, when orientation change occurs, the method onDestroy()
is called.
Take a look at the methods where your Layout Inflater is being manipulated/receiving the reference.
Upvotes: 0