Java Code Examples for com.google.android.gms.ads.NativeExpressAdView#setAdUnitId()

The following examples show how to use com.google.android.gms.ads.NativeExpressAdView#setAdUnitId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdViewHelper.java    From admobadapter with Apache License 2.0 5 votes vote down vote up
public static NativeExpressAdView getExpressAdView(Context context, AdPreset adPreset) {
    NativeExpressAdView adView = new NativeExpressAdView(context);
    AdSize adSize = adPreset.getAdSize();
    adView.setAdSize(adSize);
    adView.setAdUnitId(adPreset.getAdUnitId());
    adView.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
            adSize.getHeightInPixels(context)));

    //set video options
    if(adPreset.getVideoOptions() != null)
    adView.setVideoOptions(adPreset.getVideoOptions());

    return adView;
}