2013-04-26 47 views
1
旋轉時

嘿,我最近添加一個廣告橫幅到我的應用程序Android應用程式會使用AdMob

,我加入後,這一切工作正常......直到我旋轉手機,然後應用程序崩潰

我下面的代碼添加到我的原始應用的代碼: 在我家片段,

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" /> 

我應該打電話銷燬並做點什麼嗎?

感謝您的幫助

+2

後堆棧跟蹤... – 2013-04-26 20:18:10

+0

發現的問題,謝謝:) – 2013-04-27 06:57:08

回答

0

問題解決了。

問題是我忘了將xml代碼放在layout-land xml中。

謝謝:)