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 implementsYouTubePlayer.OnFullscreenListener
- Create a class for example named
-
- create instance of that
YoutubeMyAPI
inApplication
Class
- create instance of that
- Wherever you are passing
onInitializedListener
pass instance ofYoutubeMyAPI
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...