ahdgfd
ahdgfd

Reputation: 325

Recycler View Too much work on its main frame

I have a recyclerView in my MainActivity. It has 12 items with an Image.

My Problem is that when i start the App it is extremely slow and i always get the error:

I/Choreographer: Skipped 52 frames! The application may be doing too much work on its main thread.

But when i delete the image from the recyclerView everthing works fine.

What could be the purpose for this or what can i do that the App isnt so slow when i do this with images. I only have like 30 entries.

Sincerely Daniel

Upvotes: 2

Views: 4402

Answers (4)

Nilesh
Nilesh

Reputation: 1009

I think, there is a memory leak in your App.

please use https://github.com/square/leakcanary to check whether there is a leak or not.

Upvotes: 1

Jawad Hassan Soomro
Jawad Hassan Soomro

Reputation: 512

There is fundamental problem with your code which is running process intensive tasks on main thread, you should run such process in background thread i.e Asynctask. Using Image Library Picasso also improves overall performance of application. Please post code if any query.

Upvotes: 0

Demonsoul
Demonsoul

Reputation: 801

Without an intimate knowledge of your code, it is impossible to directly identify the issue you're running into... this is a broad performance issue which could be the cause of any cumulation of things.

That said, here are some things to look into:

  1. Resize your resources and scale them appropriately for each screen density: https://developer.android.com/guide/practices/screens_support.html

  2. If you aren't already, use the ViewHolder design pattern for your RecyclerView: https://developer.android.com/training/material/lists-cards.html

  3. Optimize your Bitmap loading (Processing Bitmaps off the UI thread is a good starting point for your issue): https://developer.android.com/training/displaying-bitmaps/index.html

Upvotes: 0

deejay
deejay

Reputation: 572

As you have said deleting images solved your issue, just simply resize your drawable images and icons. Try to minimize the resolution and keep those images and icons that are necessary for your application. An other approach is to use Multi-threading coding. Read Java Threads and Async Task for more details on Multi-Threading.

Upvotes: 0

Related Questions