0

I have set the right permissions, and the ID is correct. Layout isn't the cause of the problem, as i can display any other view(TextView, CheckBox), and it fits in the right place.

No errors or warnings are shown in logcat, only line, that indicates, that something is wrong is

Sum of ration weights is 0 - no ads to be shown

I was previously using AdMob, but it at least showed black space, when no ads were available.

Here is the code to instantiate adWhirl:

            LinearLayout layout = (LinearLayout) findViewById(R.id.layout_ad);
            AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "ID");

            RelativeLayout.LayoutParams adWhirlLayoutParams =
            new RelativeLayout.LayoutParams(
            LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT
            );
            adWhirlLayout.setBackgroundColor(Color.BLACK);
            adWhirlLayout.setLayoutParams(adWhirlLayoutParams);
            AdWhirlTargeting.setTestMode(true);

            layout.addView(adWhirlLayout, lparams);
            layout.invalidate();
Demonick
  • 2,116
  • 3
  • 30
  • 40

1 Answers1

0

The documentation for AdWhirl is pretty horrible. I'm not sure what your particular problem may be but there's a much easier way to create the AdWhirl layout which might solve your problem.

I'm assuming you have version 3.0 of the AdWhirl SDK. Instead of creating the layout through code you can simply create it through your normal XML layout file. Don't use the LinearLayout like their instructions suggest (I think it's outdated). Instead just place this element in your layout wherever you want the banner to be:

    <com.adwhirl.AdWhirlLayout
         android:layout_width="fill_parent"
         android:layout_height="wrap_content" />

Seriously, that's it. Be sure your AdWhirl key is in the Manifest as well (either within the <activity> or <application> tag):

    <meta-data android:value="Your Key"
         android:name="ADWHIRL_KEY"/>

If you really need to do anything programmatically you can give the layout an id as usual and use findViewById. Lemme know if this helps.

Tony Chan
  • 8,017
  • 4
  • 50
  • 49