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

Android

My 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

Downloaded 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.

thanx for support and note,

i will make the change soon thank you

Any 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:

AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

did 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'

I 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);

        }

"Now to add Analytics ;-)"

Soory i didn't made it!

and i will NOT.