Java 类com.google.android.gms.ads.AdView 实例源码

项目:Udacity_Gradle    文件:MainActivityFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_main, container, false);

    AdView mAdView = (AdView) root.findViewById(R.id.adView);
    // Create an ad request. Check logcat output for the hashed device ID to
    // get test ads on a physical device. e.g.
    // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device."
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build();
    mAdView.loadAd(adRequest);
    return root;

}
项目:justintrain-client-android    文件:Ads.java   
public static void initializeAds(Context context, View bannerPlaceholder, AdView adView, AnalyticsHelper analyticsHelper, String screenName) {
    initializeAds(context, adView);

    adView.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            apply(bannerPlaceholder, GONE);
            apply(adView, VISIBLE);
        }

        @Override
        public void onAdFailedToLoad(int i) {
            analyticsHelper.logScreenEvent(screenName, AD_FAILED_TO_LOAD);
        }

        @Override
        public void onAdClicked() {
            analyticsHelper.logScreenEvent(screenName, AD_CLICKED);
        }
    });
}
项目:Perfect-Day    文件:MoreInfoFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    mView = inflater.inflate(R.layout.more_info_fragment, container, false);
    ButterKnife.bind(this, mView);
    auth.getCurrentUser();
    Uri photoUrl = auth.getCurrentUser().getPhotoUrl();
    Glide.with(this).load(photoUrl).into(imageView);
    String strMeatFormat = getResources().getString(R.string.welcome_format);
    String strMeatMsg = String.format(strMeatFormat, auth.getCurrentUser().getDisplayName());
    mProfileName.setText(strMeatMsg);
    adView = (AdView) mView.findViewById(R.id.adView);
    AdRequest builder = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
    adView.loadAd(builder);
    return mView;
}
项目:editor-sql    文件:SqlTabDatasActivity.java   
private void initView() {
    mTabHeader = (TableLayout) findViewById(R.id.sql_tabview_header_tab);
    mRecycleView = (FastScrollRecyclerView) findViewById(R.id.sql_tabview_recycleview);
    mLinearLayoutManager = new LinearLayoutManager(SqlTabDatasActivity.this);
    mLinearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecycleView.setLayoutManager(mLinearLayoutManager);
    mContent = (MyHorizontalScrollView) findViewById(R.id.content);
    mRecycleView.setMinimumWidth(FeViewUtils.getScreenWidth(this));
    mToolBar = (Toolbar) findViewById(R.id.toolbar);
    mAdmobLayout = (RelativeLayout) findViewById(R.id.admob_layout);
    mRootLayout = (RelativeLayout) findViewById(R.id.rootLayout);
    mAdView = (AdView) findViewById(R.id.adView);
    mAdMobBgBtn = (Button) findViewById(R.id.admob_bg_btn);
    mAdClose = (ImageView) findViewById(R.id.admob_close);
    btn = (FloatingActionButton) findViewById(R.id.fab);
    mTabHeader.setBackground(getResources().getDrawable(R.color.table_head_bg));

    if (dataSource != SqlConstant.TABLE_DATAS_NORMAL) {
        btn.setVisibility(View.GONE);
    } else {
        btn.setVisibility(View.VISIBLE);
    }

    resultHandler = new SqlActivityResultHandler(this);
}
项目:editor-sql    文件:DbTablesActivity.java   
protected void initView() {
    mRecycleView = (RecyclerView) findViewById(R.id.sql_tabs_recycleview);
    mSwipeRefresh = (FeSwipeRefreshLayout) findViewById(R.id.recycler_view_container);
    mSwipeRefresh.setProgressViewOffset(true, -20, 150);
    toolbar = (Toolbar) findViewById(R.id.toolbar);

    mFab = (FloatingActionButton) findViewById(R.id.mFab);
    mMenu = (FloatingActionMenu) findViewById(R.id.mFam);
    mCreateNewTab = (FloatingActionButton) findViewById(R.id.sql_btn_create_tab);
    mImportTab = (FloatingActionButton) findViewById(R.id.sql_btn_import_tab);
    mAdView = (AdView) findViewById(R.id.adView);
    mAdBg = (Button) findViewById(R.id.admob_bg_btn);
    mAdClose = (ImageView) findViewById(R.id.admob_close);
    mAdmobLayout = (RelativeLayout) findViewById(R.id.admob_layout);
    mRootLayout = (RelativeLayout) findViewById(R.id.roottabslayout);
    mMenu.setClosedOnTouchOutside(true);
}
项目:MKAPP    文件:ActivityMain.java   
private void enableAds() {
    RelativeLayout rlAd = (RelativeLayout) findViewById(R.id.rlAd);
    LinearLayout llAd = (LinearLayout) findViewById(R.id.llAd);
    final AdView adView = (AdView) findViewById(R.id.adView);

    rlAd.setVisibility(View.VISIBLE);
    llAd.setVisibility(View.VISIBLE);

    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            try {
                AdRequest adRequest = new AdRequest.Builder()
                        .addTestDevice(getString(R.string.ad_test_device_id))
                        .build();
                adView.loadAd(adRequest);
            } catch (Throwable ex) {
                Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
            }
        }
    }, 1000);
}
项目:CodeInPython    文件:quiz15Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz15, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques15);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);



    return view;
}
项目:CodeInPython    文件:quiz5Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz5, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques5);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);

    return  view;
}
项目:CodeInPython    文件:quiz9Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz9, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques9);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);

    return view;
}
项目:CodeInPython    文件:quiz3Fragment.java   
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v =  inflater.inflate(R.layout.fragment_quiz3, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)v.findViewById(R.id.adViewques3);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);

    return v;
}
项目:CodeInPython    文件:quiz13Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz13, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques13);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);



    return view;
}
项目:CodeInPython    文件:quiz10Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz10, container, false);


    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques10);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);


    return view;
}
项目:CodeInPython    文件:quiz2Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.fragment_quiz2, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)v.findViewById(R.id.adViewques2);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);

    return v;
}
项目:CodeInPython    文件:quiz4Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz4, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques4);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);

    return view;
}
项目:CodeInPython    文件:quiz14Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz14, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques14);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);



    return view;
}
项目:CodeInPython    文件:quiz7Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz7, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques7);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);

    return view;
}
项目:CodeInPython    文件:quiz6Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz6, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques6);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);

    return view;
}
项目:CodeInPython    文件:GlossaryFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.fragment_glossary, container, false);
    TextView textView = (TextView)v.findViewById(R.id.glossarycontent);
    String strin = getResources().getString(R.string.glossary);
    //noinspection deprecation
    textView.setText(Html.fromHtml(strin));

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)v.findViewById(R.id.adViewGlossary);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);


    return  v;
}
项目:CodeInPython    文件:quiz8Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View v = inflater.inflate(R.layout.fragment_quiz8, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)v.findViewById(R.id.adViewques8);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);

    return v;
}
项目:CodeInPython    文件:quiz11Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz11, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques11);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);



    return view;
}
项目:CodeInPython    文件:quiz1Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment

    View v = inflater.inflate(R.layout.fragment_quiz1, container, false);
    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)v.findViewById(R.id.adViewques1);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);

    return v;
}
项目:CodeInPython    文件:FutureFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    //ca-app-pub-2683690631160044/9215612617
    View view = inflater.inflate(R.layout.fragment_future, container, false);
    TextView textView = (TextView)view.findViewById(R.id.pythonfuture);
    String str = getResources().getString(R.string.applications);
    //noinspection deprecation
    textView.setText(Html.fromHtml(str));

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewFuture);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);


    return view;
}
项目:CodeInPython    文件:quiz12Fragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_quiz12, container, false);

    String android_id = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
    String deviceId = md5(android_id).toUpperCase();
    Log.i("device id=",deviceId);
    AdView adView = (AdView)view.findViewById(R.id.adViewques12);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(deviceId)
            .build();
    adView.loadAd(adRequest);



    return view;
}
项目:fluffybalance    文件:AndroidLauncher.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initialize the Mobile Ads SDK.
    MobileAds.initialize(this, APP_ID);

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useGyroscope = false;
    cfg.useCompass = true;
    cfg.useAccelerometer = true;

    // Do the stuff that initialize() would do for you
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

    RelativeLayout layout = new RelativeLayout(this);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT,
            RelativeLayout.LayoutParams.MATCH_PARENT);
    layout.setLayoutParams(params);

    AdView admobView = createAdView();
    layout.addView(admobView);
    View gameView = createGameView(cfg);
    layout.addView(gameView);

    setContentView(layout);
    startAdvertising(admobView);
}
项目:fluffybalance    文件:AndroidLauncher.java   
private AdView createAdView() {
    mAdView = new AdView(this);
    mAdView.setAdSize(AdSize.LARGE_BANNER);

    // setup "testing" banner type
    boolean isStoreBuild = BuildConfig.FLAVOR.equals("playstore") && BuildConfig.BUILD_TYPE.equals("release");
    String adUnitId = isStoreBuild ? AD_UNIT_ID : "ca-app-pub-3940256099942544/6300978111";

    mAdView.setAdUnitId(adUnitId);
    mAdView.setId(View.generateViewId()); // this is an arbitrary id, allows for relative positioning in createGameView()
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    mAdView.setLayoutParams(params);
    mAdView.setBackgroundColor(Color.BLACK);

    return mAdView;
}
项目:arrispwgen-android    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidThreeTen.init(this);
    start_date = LocalDate.now();
    end_date = LocalDate.now();
    seed = DEFAULT_SEED;
    setContentView(R.layout.activity_main);

    // Load an ad into the AdMob banner view.
    AdView adView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().setRequestAgent("android_studio:ad_template").build();
    adView.loadAd(adRequest);

    potd_list_view = (ListView) findViewById(R.id.potd_list);

    generate_potd_list();
}
项目:quickstart-android    文件:AdViewIdlingResource.java   
public AdViewIdlingResource(AdView adView) {
    if (adView == null) {
        throw new IllegalArgumentException(
                "Can't initialize AdViewIdlingResource with null AdView.");
    }

    this.mAdView = adView;
    this.mAdListener = new AdListener() {
        @Override
        public void onAdFailedToLoad(int i) {
            transitionToIdle();
        }

        @Override
        public void onAdLoaded() {
            transitionToIdle();
        }
    };

    mAdView.setAdListener(mAdListener);
}
项目:SecretBrand    文件:HeroStatInfo.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v=inflater.inflate(R.layout.hero_stats, container, false);

    mAdView = (AdView) v.findViewById(R.id.ad_view);
    // Create an ad request. Check your logcat output for the hashed device ID to
    // get test ads on a physical device. e.g.
    // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device."
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice("121EC3F83A2EAFBD46DB00F1773A13A0")
            .build();

    // Start loading the ad in the background.
    mAdView.loadAd(adRequest);


    ButterKnife.bind(this,v);
    return v;
}
项目:aMuleRemote    文件:SearchActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    mApp = (AmuleRemoteApplication) getApplication();

    if (DEBUG) Log.d(TAG, "SearchActivity.onCreate: Calling super");
    super.onCreate(savedInstanceState);
    if (DEBUG) Log.d(TAG, "SearchActivity.onCreate: Back from super");

    if (DEBUG) Log.d(TAG, "SearchActivity.onCreate: Calling setContentView");
    setContentView(R.layout.act_search);
    if (DEBUG) Log.d(TAG, "SearchActivity.onCreate: Back from setContentView");

    getSupportActionBar().setTitle(R.string.search_title);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mFragManager = getSupportFragmentManager();

    AdView adView = (AdView)this.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("TEST_DEVICE_ID")
            .build();
    adView.loadAd(adRequest);

}
项目:sw2016    文件:MainActivity.java   
private void initAdvertise() {
    AdView mAdView = new AdView(this);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    mAdView.setAdUnitId("ca-app-pub-3406938862137540/3927782716");
    mAdView.setBackgroundColor(Color.BLACK);
    AdRequest adRequest = new AdRequest.Builder().build();
    double dppxl = (1 * (Resources.getSystem().getDisplayMetrics().densityDpi / 160f));
    int v = this.getResources().getDisplayMetrics().heightPixels;
    RelativeLayout layout = (RelativeLayout) findViewById(R.id.act_main_baseLayout);
    layout.addView(mAdView, params);
    if(v/dppxl > 720)
        mAdView.setAdSize(AdSize.BANNER);
    else
      mAdView.setAdSize(AdSize.SMART_BANNER);
    mAdView.loadAd(adRequest);
}
项目:USB_Mass_Storage_Enabler    文件:MainActivity.java   
void initADs() {

        if(enableADs) {
            //https://firebase.google.com/docs/admob/android/quick-start
            MobileAds.initialize(getApplicationContext(), getString(R.string.ad_app_id));
            AdView mAdView = (AdView) findViewById(R.id.adView);
            AdRequest adRequest = new AdRequest.Builder().build();
            mAdView.loadAd(adRequest);
            Log.d(LOG_TAG, "Ads initialized..");

            mInterstitialAd = new InterstitialAd(this);
            mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
            mInterstitialAd.setAdListener(new AdListener() {
                @Override
                public void onAdClosed() {
                    //requestNewInterstitial();
                }
            });

            requestNewInterstitial();
        }
    }
项目:uses-and-likes    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    context = this;
    listDataHeader = (List<String>) getIntent().getSerializableExtra("listDataHeader");
    listDataChild = (Map<String, List<Joke>>) getIntent().getSerializableExtra("listDataChild");
    mapJokes = (Map<String, List<Joke>>) getIntent().getSerializableExtra("mapJokes");

    CoordinatorLayout mainLayout = (CoordinatorLayout) findViewById(R.id.main_layout);
    mainLayout.setBackgroundColor(ContextCompat.getColor(context, R.color.main_categories_color));

    // get the listview
    expListView = (ExpandableListView) findViewById(R.id.likesList);
    sharedpreferences = getSharedPreferences(Util.MY_PREFERENCES, Context.MODE_PRIVATE);

    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

    listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
    listAdapter.setSharedPreference(sharedpreferences);

    // setting list adapter
    expListView.setAdapter(listAdapter);
}
项目:band-up-android    文件:UserDetailsFragment.java   
private void initializeViews(View rootView) {
    txtName = (TextView) rootView.findViewById(R.id.txtName);
    txtDistance = (TextView) rootView.findViewById(R.id.txtDistance);
    txtPercentage = (TextView) rootView.findViewById(R.id.txtPercentage);
    txtAge = (TextView) rootView.findViewById(R.id.txtAge);
    txtFavorite = (TextView) rootView.findViewById(R.id.txtFavorite);
    txtAboutMe = (TextView) rootView.findViewById(R.id.txtAboutMe);
    txtInstrumentsTitle = (TextView) rootView.findViewById(R.id.txtInstrumentTitle);
    txtGenresTitle = (TextView) rootView.findViewById(R.id.txtGenresTitle);
    txtInstrumentsList = (TextView) rootView.findViewById(R.id.txtInstrumentsList);
    txtGenresList = (TextView) rootView.findViewById(R.id.txtGenresList);
    txtSoundCloudExample = (TextView) rootView.findViewById(R.id.txt_audio_example);
    ivUserProfileImage = (ImageView) rootView.findViewById(R.id.imgProfile);
    btnLike = (Button) rootView.findViewById(R.id.btnLike);
    mAdView = (AdView) rootView.findViewById(R.id.adView);
    mSoundcloudArea = (LinearLayout) rootView.findViewById(R.id.soundcloud_player_area);
    txtFetchError = (TextView) rootView.findViewById(R.id.txtFetchError);
    txtNoSoundCloudExample = (TextView) rootView.findViewById(R.id.no_soundcloud_example);

    btnLike.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((MainScreenActivity) getActivity()).onClickLike(currentUser, v);
        }
    });
}
项目:BuildItBigger    文件:MainActivityFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_main, container, false);

    AdView mAdView = (AdView) root.findViewById(R.id.adView);
    // Create an ad request. Check logcat output for the hashed device ID to
    // get test ads on a physical device. e.g.
    // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device."
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build();
    mAdView.loadAd(adRequest);

    Button btnTellJoke = (Button) root.findViewById(R.id.btnTellJoke);
    btnTellJoke.setOnClickListener(this);
    return root;
}
项目:deathly_adiutor_free    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setView();
    String password;
    if (!(password = Utils.getString("password", "", this)).isEmpty()) {
        askPassword(password);
    }
    else // Use an AsyncTask to initialize everything
        new Task().execute();

    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
}
项目:android-protwall    文件:ActivityMain.java   
private void enableAds() {
    RelativeLayout rlAd = (RelativeLayout) findViewById(R.id.rlAd);
    LinearLayout llAd = (LinearLayout) findViewById(R.id.llAd);
    final AdView adView = (AdView) findViewById(R.id.adView);

    rlAd.setVisibility(View.VISIBLE);
    llAd.setVisibility(View.VISIBLE);

    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            AdRequest adRequest = new AdRequest.Builder()
                    .addTestDevice(getString(R.string.admob_test_device_id))
                    .build();
            adView.loadAd(adRequest);
        }
    }, 1000);
}
项目:arrispwgen-android    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidThreeTen.init(this);
    start_date = LocalDate.now();
    end_date = LocalDate.now();
    seed = DEFAULT_SEED;
    setContentView(R.layout.activity_main);

    // Load an ad into the AdMob banner view.
    AdView adView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().setRequestAgent("android_studio:ad_template").build();
    adView.loadAd(adRequest);

    potd_list_view = (ListView) findViewById(R.id.potd_list);

    generate_potd_list();
}
项目:zetcheck    文件:SlidingStationActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState)
{
    // Log.e("oncreate", "a");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sliding_station);

    setGlobalDisplay();
    setViewPagerConfig(savedInstanceState);
    setUpdateConfig();

    adView = (AdView) this.findViewById(R.id.adView1);
    AdRequest adRequest = new AdRequest.Builder().addTestDevice(
            "9F95B44EAECFE486860F1D1FAB856B0E").build();
    adView.loadAd(adRequest);
}
项目:zetcheck    文件:MenuActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_menu);

    AppData.context = this;

    mSectionsPagerAdapter = new SectionsPagerAdapter(
            getSupportFragmentManager());
    mViewPager = (ViewPager) findViewById(R.id.menu_pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOffscreenPageLimit(1);

    mViewPager.setCurrentItem(1);

    searchLinesFragment = new SearchLinesFragment();
    favoritesFragment = new FavoritesFragment();
    searchStationsFragment = new SearchStationsFragment();

    adView = (AdView) this.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().addTestDevice(
            "9F95B44EAECFE486860F1D1FAB856B0E").build();
    adView.loadAd(adRequest);
}
项目:show-java    文件:BaseActivity.java   
private void setupGoogleAds() {
    mAdView = (AdView) findViewById(R.id.adView);
    if (mAdView != null) {
        mAdView.setVisibility(View.GONE);
        if (!isPro()) {
            AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
            mAdView.setAdListener(new AdListener() {
                @Override
                public void onAdFailedToLoad(int errorCode) {
                    super.onAdFailedToLoad(errorCode);
                    mAdView.setVisibility(View.GONE);
                }

                @Override
                public void onAdLoaded() {
                    super.onAdLoaded();
                    mAdView.setVisibility(View.VISIBLE);
                }
            });
            mAdView.loadAd(adRequest);
            if (!checkDataConnection()) {
                mAdView.setVisibility(View.GONE);
            }
        }
    }
}