, AndroidMkab

Load Interstitial Ad when Navigation drawer item is clicked

In this Post I will show you how to Load Interstitial Ad when Navigation Item is clicked.

You can implement this in all your Navigation items or any one Navigation item or even items or odd items.

Watch Below Video for better understanding. 

  • First add Google Play services Library to your gradle dependencies. You can add below line in your dependencies.
  • Open your Android Manifest file and add Internet permission to it.
  • Now rebuild the project. After rebuilding the project ,
  • Open your Activity file usually MainActivity.java
  • Add below variable to it.
  • In onCreate Method of your Acitivity add below lines.
  • Now add below lines where ever you want to load the Interstitial Ad. Usually in onNavigation Item Selected.
[ihc-hide-content ihc_mb_type=”show” ihc_mb_who=”reg” ihc_mb_template=”1″ ] [/ihc-hide-content]
  • You need to add above code again wherever you want to load Interstitial ad .
  • Then give your Interstitial ad unit in Strings.xml as below. Admob id below is test ID. Replace the ID with your own Admob Interstetial Ad ID.
Install our Android App to get latest Updates.  , Load Interstitial Ad when Navigation drawer item is clicked, AndroidMkab, AndroidMkab