How Can I Extend And Implement Two Libraries At The Same Time?
Solution 1:
Multiple inheritence is not supported by Java (for better or for worse), and YouTubeBaseActivity
extends Activity
, if YoutubeBaseActivity
extended AppCompatActivity
you would have had your wish !
In my opinion not supporting multiple inheritence was the right way as it can cause the diamond problem of multiple inheritance among inexperienced developers. To Quote WikiPidea
The "diamond problem" (sometimes referred to as the "deadly diamond of death") is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If there is a method in A that B and C have overridden, and D does not override it, then which version of the method does D inherit: that of B, or that of C?
As for your problem
I would like to create an activity that shows an youtube video at the top, and a pager adapter at the bottom. I need to call a method called "getSupportFragmentManager()", but I can't do it without extending the AppCompatActivity, thats why I was trying to use both
Use YouTubePlayerSupportFragment if you are only playing a YouTube video in a single support.v4.app.Fragment. This allows you to use FragmentActivity, rather than YouTubeBaseActivity.
Post a Comment for "How Can I Extend And Implement Two Libraries At The Same Time?"