Android Question Help to create code to use Inline Adaptive Banners: setAdSize

asales

Expert
Licensed User
Longtime User
This is a banner format could be placed in scrolling content:

I tried to create the code base in this Erel's code (Adaptive Banner):
B4X:
Sub GetInlineAdaptiveAdSize As Map
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    Dim AdSize As JavaObject
    Dim width As Int = 100%x / GetDeviceLayoutValues.Scale
    Dim Native As JavaObject = AdSize.InitializeStatic("com.google.android.gms.ads.AdSize").RunMethod("getCurrentOrientationInlineAdaptiveBannerAdSize", Array(ctxt, width))
    Return CreateMap("native": Native, "width": Native.RunMethod("getWidthInPixels", Array(ctxt)), _
        "height": Native.RunMethod("getHeightInPixels", Array(ctxt)))
End Sub
But I can't see this method "setAdsize" in Adview to set the height to the banner:
Alternatively, for an existing AdView, set the ad size using AdView.setAdSize(AdSize adSize).
Or, maybe, I couldn't figure out how to use it.

Any help to solved this issue are welcome.
Thanks in advance.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…