Android: Overdraw, Why Should We Care?

Recently I am looking for new stuff for you and i found really interesting fact of our android app. Which is very interesting, Have you look it your android app, why it is slow or and crashes happens some time, all those dispute things happen because we are doesn’t carrying about overdraw and CPU using in over app.

Overdraw is a fact of screen color filling cycle, each screen divide into pixels so when we giving color to over screen the android color filler start coloring to screen but it doesn’t remove previous color, you why because we haven’t defined that remove last color and refill it. We are just giving only filling command by which it will only fill the color over the entire color which is wrong. So that when our android app start it will taking time because overdraw is present in our app. Also it will consume 0.78% of our battery .

Now check below image.

To Visualizing Overdraw on Your Mobile Device

  1. Open Developer options in the system Settings. On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.
  2. Don’t panic as your screen turns into a delirium of colors. The coloring is provided to help you diagnose your app’s display behavior.
  3. The colors are hinting at the amount of overdraw on your screen for each pixel, as follows:
    • True color: No overdraw
    • Blue: Overdrawn once
    • Green: Overdrawn twice
    • Pink: Overdrawn thrice
    • Red: Overdrawn four or more times
  4. To reduce overdraw use add this code in your oncreateview method of activity.
    @Override public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
         //overdraw remover.set background of Drawable null.
        getWindow().setBackgroundDrawable(null);
    }

    After that add this it will change this to this.

Thank you 🙂 Happy Coding…

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Android
Android basic app

Today I’ll tell you how to start with Android. For the readers who are familiar with basics of Java, it will be easier for them as code is written for Android apps requires Java programming.

Android
2
Animated Splash Screen to you Android App using Android Studio

Today I am switching you to one finest technology of this world and that is Android. In this tutorial I am showing you how you can create a animated Splash screen which is the first part of any android application creation.