DEV Community 👩‍💻👨‍💻

Zachary Powell
Zachary Powell

Posted on

What Can I Do If My Quick App Stutters While Scrolling?

When a quick app loads 100 records or more at a time, the screen will freeze when the user scrolls up or down on the page.

The code above uses the list and list-item elements to load a large amount of data. However, the element usage is improper and an exception occurs, so the views for list-item fail to be reused.

Huawei Quick App Loader is an APK file, and the list and list-item elements are implemented using ListView and BaseAdapter from Android. Therefore, the loader does not create a view for the content beyond the screen range, but instead reuses existing views and refreshes them. The view of each row is actually a list-item.

The code above only contains a single list-item element, and a view is created each time that the for loop is executed. When a large amount of data needs to be processed, more memory space is needed, which can undermine app performance, even causing the app to stutter.

Solution

You should exercise caution when using the if or for statement for list-item. You can set different types for list-items, reuse list-items as much as possible, and use for in list-items.

Top comments (1)

Collapse
 
tutrinh profile image
Tu Trinh

Vue? Thanks for sharing.

🌚 Life is too short to browse without dark mode