use of com.google.android.gms.ads.AdSize in project LibreraReader by foobnix.
the class ADS method activateAdmobNativeBanner.
public static void activateAdmobNativeBanner(final Activity a, NativeExpressAdView adViewNative) {
try {
final FrameLayout frame = (FrameLayout) a.findViewById(R.id.adFrame);
frame.removeAllViews();
frame.setVisibility(View.VISIBLE);
if (adViewNative != null) {
adViewNative.destroy();
adViewNative = null;
}
adViewNative = new NativeExpressAdView(a);
adViewNative.setAdUnitId(AppsConfig.ADMOB_NATIVE_BANNER);
int adSizeHeight = Dips.screenHeightDP() / 9;
LOG.d("adSizeHeight", adSizeHeight);
adViewNative.setAdSize(new AdSize(AdSize.FULL_WIDTH, Math.max(82, adSizeHeight)));
adViewNative.loadAd(ADS.adRequest);
adViewNative.setAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int arg0) {
frame.removeAllViews();
// frame.setVisibility(View.GONE);
}
});
frame.addView(adViewNative);
} catch (Exception e) {
LOG.e(e);
}
}
use of com.google.android.gms.ads.AdSize in project superCleanMaster by joyoyao.
the class ResultActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result);
Button btngo_to_saving_battery = (Button) findViewById(R.id.goto_saving_battery);
Button btngoto_memory_clean = (Button) findViewById(R.id.goto_memory_clean);
Button btngoto_rate_app = (Button) findViewById(R.id.goto_rate_app);
btngo_to_saving_battery.setOnClickListener(onClickListener);
btngoto_memory_clean.setOnClickListener(onClickListener);
btngoto_rate_app.setOnClickListener(onClickListener);
mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
AdSize adSize = new AdSize(300, 250);
adSize.equals(AdSize.BANNER);
mAdView.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
// Code to be executed when an ad finishes loading.
Log.d(TAG, "onAdLoaded");
}
@Override
public void onAdFailedToLoad(int errorCode) {
Log.d(TAG, "onAdFailedToLoad");
// Code to be executed when an ad request fails.
}
@Override
public void onAdOpened() {
Log.d(TAG, "onAdOpened");
// Code to be executed when an ad opens an overlay that
// covers the screen.
}
@Override
public void onAdLeftApplication() {
Log.d(TAG, "onAdLeftApplication");
// Code to be executed when the user has left the app.
}
@Override
public void onAdClosed() {
Log.d(TAG, "onAdClosed");
// Code to be executed when when the user is about to return
// to the app after tapping on an ad.
}
});
}
Aggregations