Admob please help
in
Android Processing
•
2 years ago
I need to know how to hide an ad on user interaction using processing friendly code.
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Window window = getWindow();
- RelativeLayout adsLayout = new RelativeLayout(this);
- RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
- // Displays Ads at the bottom of your sketch, use Gravity.TOP to display them at the top
- adsLayout.setGravity(Gravity.TOP);
- AdView adView = new AdView(this, AdSize.BANNER, "a14e545fe4eb06c"); // add your app-id
- adsLayout.addView(adView);
- AdRequest newAdReq = new AdRequest();
- // Remark: uncomment next line for testing your Ads (fake ads)
- //newAdReq.setTesting(true);
- adView.loadAd(newAdReq);
- window.addContentView(adsLayout, lp2);
- }
Thats what I have after my void draw to show the ad but i have no clue on how to hide it on user action , can anyone help me??
- adView.setVisibility(View.GONE);
That code is supposed to hide it but I don't know how to use it in my code without having compiler errors.
4