Android Youtube Player API activity finish and create

You can do following steps to ensure memory leak problem to get resolved:

  • Use Application Context
    • Create a class for example named YoutubeMyAPI which implements YouTubePlayer.OnFullscreenListener
    • create instance of that YoutubeMyAPI in Application Class
  • Wherever you are passing onInitializedListener pass instance of YoutubeMyAPI by getting ((MyApp)getApplicationContext()).instanceOfYoutubeMyAPI

Hopefully you got the general idea to implement this obviously this is just a workaround there are better ways to do this...