🖋️
Learn Write Share
  • About me
  • Android Bits
    • The Other Side to Usability - Part 1
    • The Other Side to Usability - Part 2
    • Building a synthetic task stack of multiple activities in Android
    • Linking a text having a phone number in Android
    • DROIDCON Italy
  • Security Bits
    • Threat Modelling for AI - Changing the way you view Trust Boundaries
    • Who Do You Think Owns Your Android Application?
    • Secure Infrastructure: Tools & Techniques
    • DNS rebinding attacks - Useful resources
    • Semgrep and Dependabot in path to production - SAST and SCA Tooling
  • AWS
    • AWS account access using saml2aws and assume-role
  • MySQL
    • Setting up MySQL
Powered by GitBook
On this page

Was this helpful?

  1. Android Bits

The Other Side to Usability - Part 2

PreviousThe Other Side to Usability - Part 1NextBuilding a synthetic task stack of multiple activities in Android

Last updated 4 years ago

Was this helpful?

Hey there... As promised, listing down a few more tricks to make your Android app more usable. The previous tricks and tips can be found . Now that we have achieved an amazing version 3 of our app, we still see a glaring issue.

THERE IS SIGNIFICANT LAG WHEN WE SCROLL THROUGH THE PRODUCTS.

Of course, we solved the issue of unblocking the UI thread when while loading the products, but every time we scroll up and down through the list, we have a significant delay in the thumbnails of the products appearing. Yes..for the first time, it is understandable. But every time, I scroll, if I have to wait for the image, it is annoying. The reason is the images are being downloaded each time you scroll. So we need to introduce caching. is an example on how to implement caching. This solves the issue at hand.

But if we look at the time the first page itself takes to load, it is significant. What can be going wrong?

Looking at the layout, we can see we have a overdraw situation. The topic of overdraw is very well explained here - So following the steps, if we look at the app - it is DARK RED.

Viewing the application in the Hierarchy Viewer, we can see the following:

When we implement a custom view, Layout and Drawing are some standard methods that the framework calls on the view.

  • Layout is a two pass process: a measure pass and a layout pass. The measuring pass is a top-down traversal of the view tree. Each view pushes dimension specifications down the tree during the recursion. At the end of the measure pass, every view has stored its measurements. The second pass - i.e layout, is also top-down. During this pass each parent is responsible for positioning all of its children using the sizes computed in the measure pass.

  • Drawing is handled by walking the tree and recording the drawing commands of any View that needs to update.

As you can see, we have an extra Linear Layout in between the ImageView and the parent Linear Layout. By just reducing that layer, we reduce the time for the above processes too

Now the app loads faster, but does it look great? Is it engaging and well-styled!

We can achieve a better look by implementing a consistent theme. For this example, we have added the Holo.Light.DarkActionBar theme. By introducing an App Level theme in styles.xml, it can improve the look.

Issue

Solution

Blank Screen

Show a loader

Continuous loader

Load images in the background

Images downloaded every time on scroll

Implement caching

The overdraw takes time to render the view

Remove redundant layouts

Inconsistent coloring

Android Themes

That's it. These are some of the guidelines if followed can help make your application usable in actual terms. :)

here
Here
http://www.curious-creature.org/2012/12/01/android-performance-case-study/
Hierarchy Viewer