• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps getHeight() vs getTop() - getBottom()

rollie

Lurker
I just started learning android development (and Java for that matter), and was trying to modify the Sliding Drawer widget. I notice going through the code I find lines like

Code:
final int childHeight = mHandleHeight;
int height = getBottom() - getTop() - childHeight - mTopOffset;

Why is "getBottom() - getTop()" used instead of getHeight()? Also, why do they create a variable specifically for childHeight when one already exists (mHandleHeight)?

Edit: Mostly answered my own question - in the code, getHeight() is simply bottom - top, so yes it's the same. Note that the snippet above is slightly different from the basic slidingDrawer code because 'mTop' and 'mBottom' are not available to us mere mortals and have to be replaced to get the widget to work :)
 
Back
Top Bottom