I hide admob adview by view.gone:
//adView.setClickable(false);
//adView.clearFocus();
//adView.setEnabled(false);
//adView.setFilterTouchesWhenObscured(true);
/
Setting adView.setVisibility(View.GONE)
and removing the AdMob view from the view hierarchy will hide the ad and prevent user interaction in most cases.
Don't forget to end the AdView lifecycle when the Activity displaying the ad is finished (destroyed). From the AdMob SDK Javadoc:
public void destroy()
Destroys the AdView. The AdView should no longer be used after this method is called.
Make a call to destroy()
in the Activity's onDestroy()
callback:
@Override
public void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}