Sunday, April 8, 2012

android:windowBackground="@null” to improve app speed


I just read a blogpost by Romain Guy on how to speed up an app UI. He basically says that if your app uses opaque views you can set the background to @null in your Activity 's style using:




<item name="android:windowBackground">@null</item>



Does this work? I was willing to test this using FPS as he did but I didn't find a clear way of getting that info.



I have read some threads saying you need to do it yourself. I am about to add a custom view that draws the FPS in the onDraw() method and calls invalidate() to get call all the time.



Although this works, I would like to know if there is a better way to analyse FPS in an application.


Source: Tips4all

2 comments:

  1. That blogpost has a source code of samples. Check FpsImageView.java.

    ReplyDelete
  2. If the UI of your application is completely drawing the window contents, you should always set windowBackground to null. This prevents the framework from filling your window with the default background color, so it is one less pass that is needed to render each frame which means you can spend your own time drawing that number of pixels.

    ReplyDelete