I am integrating AdMob into my app and I wonder how to disable Ads correctly. I want to give the user the ability to disable them. I don\'t want to get any problems with AdM
Make a class which is called Ads
like this
public static boolean Show(AdView mAdView){
if(mAdView != null){
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
return true;
}
return false;
}
public static void Remove(AdView mAdView,ViewGroup parent){
root.removeView(mAdView);
}
public static void Remove(AdView mAdView,RelativeLayout mLayout){
mLayout.removeView(mAdView);
}
public static void Remove(AdView mAdView, LinearLayout mLayout){
mLayout.removeView(mAdView);
}
}
Now import it in the class where you want to remove an AdView from
use Ads.Remove(AdView, parent);
to remove it.
`Ads.Remove("the add view itself", the ViewGroup or layout where it is");