BilalMr
BilalMr

Reputation: 335

Android make contol of ADmob hide addview window after click on it

I am developing an android application and I want close the window of view adds after I click on the adds window using Resume event.I put a rule in resume event but this rule make adds never show. so if there is a way to make the view adds disappears when I return to my application? this is my code:

@Override
protected void onResume() {
    // TODO Auto-generated method stub
     if (adView != null) {
         adView.destroy();
        }
    super.onResume();
}

Upvotes: 3

Views: 106

Answers (2)

BilalMr
BilalMr

Reputation: 335

this is the right code:

protected void onResume() {
        // TODO Auto-generated method stub
        adView.setAdListener(new AdListener() {
            @Override
              public void onAdOpened() {
                // Save app state before going to the ad overlay.
              }

            @Override
            public void onAdClosed() {
                adView.setVisibility(View.GONE);
                // TODO Auto-generated method stub
                super.onAdClosed();
            }

        });


        super.onResume();
}

Upvotes: 3

stinepike
stinepike

Reputation: 54672

use following to disappear the view.

adView.setVisibility(View.GONE):

set an onClickListener on adView then in onClick call this method.

Upvotes: 0

Related Questions