Search code examples
androidmopub

Android. MoPub SDK. Code snippet integration


I'm trying to integrate MoPub into my application but I am not sure on where exactly to place the code snippet inside the onCreate() method of my activity:

mAdView = (MoPubView) findViewById(R.id.adview);
mAdView.setAdUnitId("xxxxxxxxxxx"); // Enter your Ad Unit ID from www.mopub.com
mAdView.loadAd();

Do i place it before or after the call to super.onCreate(savedInstanceState); ?

Yes, I know it's a very trivial question.


Solution

  • Write your code after setContentView because you use findViewById for mAdView.