2

最近、アプリに広告バナーを追加しました

追加した後、すべて正常に動作します...電話を回転させてからアプリがクラッシュするまで

元のアプリ コードに次のコードを追加しました。

On create view:
...
    mAdStatus = (TextView) v.findViewById(R.id.status);
    mAdView = (AdView) v.findViewById(R.id.ad);
    mAdView.setAdListener(new MyAdListener(mAdStatus));

    AdRequest adRequest = new AdRequest();
    adRequest.addKeyword("sporting goods");
    mAdView.loadAd(adRequest);
return v;

xmlで:

    <LinearLayout
android:id="@+id/ad_catalog_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView android:id="@+id/status"
    android:layout_width="match_parent"
    android:layout_height="0px"
    android:layout_weight="1"
    android:text="" />
<com.google.ads.AdView xmlns:googleads="http://schemas.android.com/apk/lib/com.google.ads"
    android:id="@+id/ad"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    googleads:adSize="SMART_BANNER"
    googleads:adUnitId="@string/admob_id" />

破壊して何かをする必要がありますか?

助けてくれてありがとう

4

1 に答える 1

0

問題が解決しました。

問題は、layout-land xml にも xml コードを入れるのを忘れていたことです。

ありがとう :)

于 2013-04-27T06:56:43.120 に答える