Wanted to make interstitial ads in my MoPub library but can't understand how to implement this. Please help me with the following code (Official MoPub Code) :
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I made the following JAVA code for B4A , but it seems that it is wrong :
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
So in B4A to make appear ad i write following code:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
But nothing happens.
Thanks
			
			
			
				B4X:
			
		
		
		public class ExampleActivity extends Activity implements InterstitialAdListener {
    MoPubInterstitial mInterstitial;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mInterstitial = new MoPubInterstitial(this, YOUR_INTERSTITIAL_AD_UNIT_ID_HERE);
        mInterstitial.setInterstitialAdListener(this);
        mInterstitial.load();
    }
    @Override
    protected void onDestroy() {
        mInterstitial.destroy();
        super.onDestroy();
    }
    // InterstitialAdListener methods
    @Override
    public void onInterstitialLoaded(MoPubInterstitial interstitial) {
        if (interstitial.isReady()) {
            mInterstitial.show();
        } else {
            // Other code
        }
    }I made the following JAVA code for B4A , but it seems that it is wrong :
			
				B4X:
			
		
		
		package mopubint;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.AbsObjectWrapper;
import com.mopub.mobileads.MoPubInterstitial;
import com.mopub.mobileads.MoPubInterstitial.InterstitialAdListener;
@BA.Author ("Johnmcenroy")
@BA.Permissions(values={"android.permission.INTERNET","android.permission.ACCESS_NETWORK_STATE","android.permission.ACCESS_COARSE_LOCATION"})
@BA.DependsOn (values={"mopub-sdk","android-support-v4"})
@BA.ActivityObject
@BA.Version(1.0F)
@BA.ShortName("MopubInterstitial")
public class MoPubInt extends AbsObjectWrapper<MoPubInterstitial>  {
    InterstitialAdListener listener;
    MoPubInterstitial mInterstitial;
    
   public void setContentView(BA pBA, String LayoutName){
          pBA.activity.setContentView(BA.applicationContext.getResources().getIdentifier(LayoutName, "layout", BA.packageName));
      }
    
   /**
    * // Enter your Ad Unit ID from www.mopub.com
    */
   public void InitialiseInterstitial(BA pBA , String mAdUnitId)
     {
      mInterstitial = new MoPubInterstitial(pBA.activity, mAdUnitId);
      mInterstitial.setInterstitialAdListener(listener);
      mInterstitial.load();
      mInterstitial.show();
     }
}So in B4A to make appear ad i write following code:
			
				B4X:
			
		
		
		Sub Globals
    Dim ads As MopubInterstitial
End Sub
Sub Activity_Create(FirstTime As Boolean)
    ads.setContentView ("main") 'main.xml in res folder - read-only
    ads.InitialiseInterstitial("ae773452d1cf11e295fa123138070049") 'Your MoPub Unit ID
End SubBut nothing happens.
Thanks
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		