javaandroidonresumeadview

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();
}

Solution

  • 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();
    }