This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Android and the fly likes Help in Understanding View.onSizeChanged() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Help in Understanding View.onSizeChanged()" Watch "Help in Understanding View.onSizeChanged()" New topic
Author

Help in Understanding View.onSizeChanged()

zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 152

Hi guys can anyone help me in understanding this method with an example where it is absolutely necessary to use this method,I tried using docs and forums but not getting an clear idea about this.Any examples or tutorials would be highly helpful

Thanks
Zoheb
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Zoheb when we create our own View, we can override this method to know the size of our View i.e. the area in which its being displayed. When our view is first initialized, the constructor is called but at that time you don't know the area available to your view. This method is called before the onDraw method so that you know how much area is available to your view so that you can draw everything in that area...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 152

Hi Ankit Thanks for the reply can you provide some code where you have used this,I just want to understand it better
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Check this android game tutorial...
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 152

Hi Ankit Checked the tutorial the things are clear now and the game is awesome
 
wood burning stoves
 
subject: Help in Understanding View.onSizeChanged()