in Education by
I am wrapping an AdManagerAdView in an AndroidView so I can use it in Jetpack Compose. The image fails to load when I use it in a LazyColumn AND the AdManagerAdView tries to load the image before the composable is on screen. If I scroll quickly to that element, so LazyColumn composes it AND it is on screen before the image comes back from the ad server, it works as expected. LazyColumn { items(5) { SomeOtherComposable(it) } item { AndroidView( modifier = Modifier .width(300.dp) .height(250.dp) .background(Color.Green), factory = { context -> val adView = AdManagerAdView(context) adView.adSize = AdSize.MEDIUM_RECTANGLE adView.adUnitId = adUnitId adView.loadAd(Builder().build()) adView } ) } items(5) { SomeOtherComposable(it) } } For demo purposes... @Composable fun SomeOtherComposable(i: Int) { Text( text = "SomeOtherComposable $i", modifier = Modifier .fillMaxWidth() .height(320.dp) .background(Color.White) ) } This also works fine if the wrapped AdManagerAdView is used in a non-lazy Column or any other Compose layout. This feels like a weird timing thing in LazyColumn that just happens to manifest when the Composable isn't on screen yet since using it in a regular Column works fine under the same scenario. Has anyone experienced anything like this? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
factory is only called once when view firstly appears, then the view is cached. If your view is off the screen, adView seems to not load the add. You can move loadAd into update - this method is called on each recomposition: factory = { context -> val adView = AdManagerAdView(context) adView.adSize = AdSize.MEDIUM_RECTANGLE adView.adUnitId = "/6499/example/banner" adView }, update = { adView -> adView.loadAd(AdManagerAdRequest.Builder().build()) },

Related questions

0 votes
    I am adding an background image to the Splash screen, but is not rendering the image. Sometime it load ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    Ok here is the deal. I have to store a couple of images (tiff format) into a sql database.They ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    Hello I am quite new to pygame and I am trying to make an intro for a game where the user hovers ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    I am working on an application that maintains a connection for several purposes, such as publishing an ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    When does the browser stop rendering the HTML? (a) Inline JavaScript block (b) External JavaScript file (c ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    What does the rendering engine do when it encounters JavaScript? (a) Skips the code (b) Continues painting ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 22, 2021 in Education by JackTerrance
0 votes
    I'm trying to overlay 2 ImageViews, one with the background and one with an animated (using ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I'm trying to overlay 2 ImageViews, one with the background and one with an animated (using ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    Can anyone help me, Im trying to make a simple app where you touch the screen and 4 images are ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    Can anyone help me, Im trying to make a simple app where you touch the screen and 4 images are ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    I am working on a code pen and am having an issue where initially my main element would be exactly ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I have a UITableView of customers where a row/customer is selected. The user can then push another view ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I have a UITableView of customers where a row/customer is selected. The user can then push another view ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
0 votes
    I have a UITableView of customers where a row/customer is selected. The user can then push another view ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
0 votes
    I have a UITableView of customers where a row/customer is selected. The user can then push another view ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 24, 2022 in Education by JackTerrance
...