Do you know about the implementation of ViewStub?
For your problem, ViewStub is used to place AdMob ads in Footer , you just need to create a layout for this footer, and then include this layout in your XML layouts (action layouts) using the ViewStub example.
Here is an example for implementing ViewStub, yes for the title bar, but you can take the concept from it.
Now, to optimize the solution (code), you can create an Abstract class and extend the action and include the AdMob ad class in it.
For instance:
public abstract class BaseActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public void setFooterAds() {
Now you just need to extend this BaseActivity class in your Activity classes and call the setFooterAds () method to display AdMob ads.
source share