So I'm trying out making a live wallpaper and I'm using the sample
code provided in the SDK for the cube live wallpaper

I wanted to use this code to get the height/width of the display


    @Override
    public void onCreate(SurfaceHolder surfaceHolder) {
      super.onCreate(surfaceHolder);

      Rect frame = getSurfaceHolder().getSurfaceFrame();
      float width = frame.width();
      float height = frame.height();
      // By default, we don't get touch events, so enable them.
      setTouchEventsEnabled(true);
    }

Unfortunately, when I run this code, the width and height return as 0,
though if I put this in onVisibilityChanged, the correct values are
returned, why is this and is it suitable to move the code to
onVisibilityChanged?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to