Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6831635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:45:38+00:00 2026-05-26T22:45:38+00:00

Long version: I have an Android game. In each screen I’m showing the ads

  • 0

Long version: I have an Android game. In each “screen” I’m showing the ads BUT the game screen itself – where you actually play. Now, if you launched the app-game (ad begins to load) and then clicked on “Start” before the ad has finished loading – it won’t be shown when it should be (only a little strip of it)

Short version: Calling AdView.loadAd and then calling AdView.setVisibility(View.INVISIBLE) before the ad was received will yield a weird result if we call AdView.setVisibility(View.VISIBLE) after the ad is loaded.

This happens:

enter image description here

Instead of, for example:

enter image description here

Now, clicking on this tiny strip left is still counted as clicking on the ad – clicking on it does whatever clicking on the ad would do (launching the browser and such…)

And should you go back to the home screen (I.E click the home button) then get back to the application, the ad is seen back again as it should.

Did anyone encouter it, and does anyone have any idea how to solve it? Thanks.

EDIT: Here is the relevant code:

Creating the ad view:

this.mAdView = new AdView(this, AdSize.BANNER, "xxxxxxxxxxxxx");

Creating the layout params:

final FrameLayout.LayoutParams adViewLayoutParams =
            new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
                    FrameLayout.LayoutParams.WRAP_CONTENT,
                    Gravity.TOP | Gravity.CENTER_HORIZONTAL);

Creating the root view group, and its layout params:

final FrameLayout frameLayout = new FrameLayout(this);
final FrameLayout.LayoutParams frameLayoutLayoutParams =
            new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,
                    FrameLayout.LayoutParams.FILL_PARENT);

Adding to the root view group:

frameLayout.addView(this.mAdView, adViewLayoutParams);

And eventually, setting content view:

this.setContentView(frameLayout, frameLayoutLayoutParams);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:45:38+00:00Added an answer on May 26, 2026 at 10:45 pm

    I have managed to solve it in this way:

    1. In the method which changes the visibility, I first check is the ad was loaded. If it was not, I don’t change the visibility:

    2. Set an AdListener for the AdView. in the onReceivedAd method, I check the condition to hide it – if it should be hidden, I hide.

    Works fine this way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I downloaded Android 2.2 source code a long time ago but it didn't have
I'm trying to make a database in android but I have this problem,erase the
I am developing android version of an iPhone application. But, I found that in
Hopefully this won't be too long-winded, but trying to be complete: So I have
I have an android XML and I am trying to get the ads to
my android application performance is low, it takes a long startup time. i have
How do you manage versions of work flows in WF when you have long
Long version: Those familiar to the standardization nightmare of the RSS-family, may know that
short version: Is there a good time based sampling profiler for Linux? long version:
Short version: assuming I don't want to keep the data for long, how do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.