domingo, 29 de enero de 2017

Delay on list view

On this week was some funny, I started the week working on an issue with the display the chat list on Wappo. The issue was a delay to it show the chats. At the beginning, I thought that was the query to quickblox, because to I got all the information I needed make 3 queries (To get the chatList, another to get the contact information and finally the avatar from the user). I tried so hard for several minutes but I could not get the solution Then I immediately ask for help to Macho. He suggested to me that I created a database on the app to save all the information on the phone. Then, when the app started I only needed load first the information from the database and after I load the information from Quickblox.



To I made the database, I used SQLite because was really easy to use and very similar to Hibernate. I did not have troubles on this part. I just only create 3 classes from the implementation: one from the design of the table, another from database creation and the last for the queries. I used this tutorial to learn SQLite. When I finished all the implementation, the app had the same delay again. WTF!? How could be possible?. Now I did not idea the could be. Then I began to run my code part by part until found the issue.


The issue was in the view, exactly on the adapter from the list view. When the app created an item on the Listview, this needed iterate severals time the creation to adjust the components. I found this solution to optimize the view and I used this solution.



No hay comentarios:

Publicar un comentario