Child pages
  • PreferenceScreen és AdMob
Skip to end of metadata
Go to start of metadata
Konfigurációs activity-be szeretnék reklámot berakni:

<PreferenceScreen 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:myapp="http://schemas.android.com/apk/res/com.tafaya.android.app" 
>
<PreferenceCategory android:title="">
...
<com.admob.android.ads.AdView android:id="@+id/ad"
android:layout_width="fill_parent" android:layout_height="wrap_content"
myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF"
myapp:secondaryTextColor="#CCCCCC" />
</PreferenceCategory>
</PreferenceScreen>

Erre ezt kapom: 

java.lang.RuntimeException: Unable to start activity ComponentInfo{...}: java.lang.ClassCastException: com.admob.android.ads.AdView

Mi lehet a gond?

 
 
 
      
      
Page viewed times
#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels

1 Comment

  1. Gugli segített:

    http://stackoverflow.com/questions/4003701/how-do-i-put-an-admob-adview-in-the-settings-screen-for-a-live-wallpaper

    Ami még zavaró, hogy nekem is NPE-t dob itt, vagyis az adView null lesz:
    AdView adView = (AdView) this.findViewById(R.id.myad);
    adView.requestFreshAd(); // itt dob NPE-t