On May 1, 12:40 am, William Ferguson <
william.ferguson...@gmail.com>
wrote:
William,
You are trying to get the adUnitId from the strings.xml, as I said
trying using the attrs.xml to define the tag, i.e.
attrs.xml file in the res/values directory as follows
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="com.google.ads.AdView">
<attr name="adSize">
<enum name="BANNER" value="1"/>
<enum name="IAB_MRECT" value="2"/>
<enum name="IAB_BANNER" value="3"/>
<enum name="IAB_LEADERBOARD" value="4"/>
</attr>
<attr name="adUnitId" format="string"/>
</declare-styleable>
</resources>
and then in your layout xml define your AdView, e.g.
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a111bbbccddd"
ads:adSize="BANNER"/>
The only thing is you'll have to enter the id in multiple places if
you have several AdViews.
One thing to note is that you need to declare the ads namespace in
your layout xml. i.e.
xmlns:ads="
http://schemas.android.com/apk/res/
com.yourdomain.yourpackage"