0

This is my first question on SO so please be gentle.

My layout basically looks like below. What i want to do is: hide the MobclixMMABannerXLAdView while the ad is not filled. Is this possible with an linear layout like this? can this be done with small changes in code?

My idea was to implement the MobclixAdListener and set View.GONE but it seems there has to be a shorter way.

So my question is: is there a shorter way?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:windowSoftInputMode="stateHidden"
android:focusable="true" android:focusableInTouchMode="true"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:id="@+id/mainLayout">
<com.mobclix.android.sdk.MobclixMMABannerXLAdView android:id="@+id/banner_adview" android:layout_height="wrap_content" android:layout_width="320dp"></com.mobclix.android.sdk.MobclixMMABannerXLAdView>
<ScrollView android:id="@+id/ScrollView01"
    android:layout_width="fill_parent" android:layout_height="wrap_content">
</ScrollView>

elgubbo
  • 59
  • 1
  • 9
  • 1
    I've submitted your question to our engineers. In the meantime, I suggest being careful when you’re hiding the adview to stop calling for or refreshing ads, as this will keep the ads running in the background causing a leak and impacting your performance. – Mobclix Sep 19 '11 at 22:15
  • Just to follow up to your question, there is no shorter way. Setting Visibility to GONE is the standard means of hiding views on Android. If you have any other questions, file a support ticket. – Mobclix Sep 30 '11 at 18:24
  • @Mobclix do you have any idea regarding [this](http://stackoverflow.com/questions/12089398/mobclix-ads-not-showing-in-android) question PL! – swiftBoy Aug 23 '12 at 12:26

1 Answers1

0

I had the same problem. In my case I did implemented the MobclixAdViewListener:

@Override
public void onSuccessfulLoad(MobclixAdView view) {
    Logger.verbose(LOG_TAG, "The ad request was successful!");
    adView.setVisibility(View.VISIBLE);
}

@Override
public void onFailedLoad(MobclixAdView view, int errorCode) {
    Logger.verbose(LOG_TAG, "The ad request failed with error code: " + errorCode);
    adView.setVisibility(View.GONE);
}

One other thing my view starts GONE and when I have an ad I will show the view and when I don't have an ad I hide the view

Pedro Rainho
  • 4,234
  • 1
  • 19
  • 21