My app's screen looks like this Screenshot .
As you can see I made an App with ads (admob), but there is a bug, I cant fix.
Code:
private AdView adView;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fullscreen);
//create adView
adView = (AdView) findViewById(R.id.adView);
AdRequest request = new AdRequest();
adView.loadAd(request);
}
Layout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/linearlayout"
android:orientation="vertical">
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="....."
ads:testDevices="....." >
</com.google.ads.AdView>
</LinearLayout>
I got no error message in logcat and the app didnt crash. Hope you can help! I already reboot my phone and restarted eclipse.
EDIT: Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.stefan.game"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.stefan.game.FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
</manifest>
Firstly try a clean build. IT could be that you are getting the wrong resource ids being applied.
Otherwise, try removing the theme attributes for your app and your activity. If the layout XML you provided above is the full XML then I think you have misconfigured the theme such that you either have a list or repeating background that is being incorporated into your activity layout.
You should try to create an integer to count the instances of your ads. First see if your integer is superior to 1.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.