0

I try to change the image on 15 ImageViews on the same time in my Android app with the setImageResource() method, but I either get this error message: I/Choreographer: Skipped 46 frames! The application may be doing too much work on its main thread.. Or the app crashes.

Here is the XML code of how I set up the ImageViews:

<ImageView
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:adjustViewBounds="true"
   app:srcCompat="@drawable/logo"
   android:id="@+id/logo1" />

And here is how I setup the ImageViews and change their image:

private ImageView logo1;
private ImageView logo2;
...
private ImageView logo15;

logo1 = (ImageView) findViewById(R.id.logo1);
logo2...
...
logo15 = (ImageView) findViewById(R.id.logo15);

logo1.setImageResource(R.drawable.newLogo1);
logo2...
...
logo15.setImageResource(R.drawable.newLogo15);

If I were to only change the image for one ImageView the app works fine, but when I change 15 at the same time the app crashes..

Peter
  • 1,848
  • 4
  • 26
  • 44

1 Answers1

0

"Skipped 46 frames!" means some heavy processing is in your application.

Refer this for more info : The application may be doing too much work on its main thread

I recommend using recycler view of images rather than loading all of them at once.

Anonymous
  • 2,184
  • 15
  • 23