public void onFinishFetchAd() { MoPubView view = mMoPubViewReference.get(); if (view != null) { view.removeAllViews(); mAdView.setVisibility(View.VISIBLE); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL; view.addView(mAdView, layoutParams); view.adLoaded(); } }
private void adDidLoad() { Log.i("MoPub", "Ad successfully loaded."); mIsLoading = false; scheduleRefreshTimerIfEnabled(); mMoPubView.removeAllViews(); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER); mMoPubView.addView(this, layoutParams); mMoPubView.adLoaded(); }