Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Sultan Aljaradi
2,592 PointsMy FUN FACTS APP
https://play.google.com/store/apps/details?id=com.saif.coderdesignerinc.funfacts
download my fun fact app
i make some change: i chang the icon i add languages to the app(Arabic and english for now). add many fun facts use an array in string.xml
soon i will add admob
4 Answers
Jeff Janes
8,033 PointsDownloaded to support. You might want to swap out the third or fourth screenshot though, repeats the same fact, even if it does have a different colored background.
Sultan Aljaradi
2,592 Pointsdid you make sure you put the correct code??
in main Activity put:
private AdView mAdView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
and IMPORT
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
in the fragment of activity res/layout/activity_fun_facts:
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-9612930312281873/7612468945"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_alignParentBottom="true" />
in Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxxxxxx.funfacts" >
<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_ar"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.xxxxxxx.funfacts.FunFactsActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
</manifest>
in App gradle :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.1.71'
Mark Halverson
5,749 PointsI hard two errors....first, one of my imports was missing something...gms, I think. Next I didn't have the private AdView mAdView;
Now to add Analytics ;-)
public static class AdFragment extends Fragment {
private AdView mAdView;
public AdFragment() {
}
@Override
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
mAdView = (AdView) getView().findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
}
Sultan Aljaradi
2,592 Points"Now to add Analytics ;-)"
Soory i didn't made it!
and i will NOT.
Sultan Aljaradi
2,592 PointsSultan Aljaradi
2,592 Pointsthanx for support and note,
i will make the change soon thank you
Mark Halverson
5,749 PointsMark Halverson
5,749 PointsAny success on AdMob?
Using the docs @ https://developers.google.com/mobile-ads-sdk/docs/admob/android/quick-start
I keep getting the following error:
error: cannot find symbol class Builder
Code per the Doc: