Our app is getting hit pretty hard by a memory leak. I\'ve found that the root cause is the AdMob AdView keeping references to old activities. The problem is pretty well d
Ravishi,
Your question is to the point, and I have failed to address it in my solution. As far as I can tell the solution I've found works only dynamically, where you can choose your activity while calling the sdk...
The reason my code does not have a use example, is because my solution is a bit more complicated then the one I presented, involving an entire wrapping framework I've build around the Android framework, where the AdMob relation to the application is via an intermediate module, which puts the ad dynamically using the single activity instance.
I really doubt you can avoid the memory leak simply using the Android XML.
In any case, if you are into the memory leak business, you might as well check out your AsyncTask usage... it also has its own memory leak behavior... so here is my solution
best of luck...
-- UPDATE -- 07/10/14
Someone just upvoted my answer, its preposterous that this issue still exists, it has been almost three years since my original answer, and people still have memory leaks in their apps because of AdMob... from Google... that made Android....
Anyway, I just wanted to add that you should probably set the theme of the AdMobActivity to transparent, it would prevent the flickering.
-- UPDATE -- 28/02/16
Four years...
-- UPDATE -- 09/03/17
Five years... Someone at Google please wake up, and hire real monkey to do the job :)
Adam.