Go Back   Android Forums > Android Discussion > Android Lounge
Android Lounge A place for general Android discussion and questions.
Gamers - Check out our new sister sites!
Nintendo Wii U!    |    OUYA - $99 Android System!

test: Reply
 
LinkBack Thread Tools
Old July 5th, 2010, 08:21 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jul 2010
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Cry about typecasting in android source

Dear Sir,

as you know, we can see "CalculatorDisplay.java" in git.

if you open the file, you can see line 59, 60(calc.adjustFontSize((TextView)getChildAt(0))

in here, I have a question.

I searched for getChildAt, which it is in ViewGroup class.
both android.widget.ViewGroup and android.view.TextView are sibling
and two class received inheritance from android.view.View
in addition, until now, I know that it is possible that typecasting is inheritance relative.

so I can not understand why (TextView)getChildAt(0) is Ok??

if someone know this reason, can you explain for me?

proandceo is offline  
Last edited by proandceo; July 5th, 2010 at 08:26 AM.
Reply With Quote
Sponsors
Reply
Tags
calculator, git, textview, viewgroup


Go Back   Android Forums > Android Discussion > Android Lounge
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 08:45 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.