Answer the question
In order to leave comments, you need to log in
There is a problem with the application, how can I fix it?
Good afternoon dear developers!
I wanted to make an animated gradient background like instagram
It works fine on all phones without problems, but when you open the application on MEIZU and XIAOMI Smartphones, it gives an error and the application closes immediately
The error itself
android.content.res.Resources$NotFoundException: File res/drawable/anim_list.xml from drawable
resource ID 0x7f07005a
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
_gradientLayout = (RelativeLayout) findViewById(R.id.splash_layout);
_gradientLayout.setBackgroundResource(R.drawable.anim_list);
anim = (AnimationDrawable) rl.getBackground();
anim.setExitFadeDuration(1000);
}
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/first_gradient"
android:duration="2000" />
<item
android:drawable="@drawable/second_gradient"
android:duration="3000" />
</animation-list>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="45"
android:endColor="#0b648e"
android:startColor="#0b3549" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="45"
android:endColor="#0b3549"
android:startColor="#0b648e" />
</shape>
Answer the question
In order to leave comments, you need to log in
"In OnCreate I do" should be wrapped in a try catch. It should no longer fall at startup.
Then for these models, with which there are problems - set where the "res/drawable/anim_list.xml" has gone.
And in case of an error, execute the code that finds it. If possible, filter by model.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question