当前位置: 首页>>代码示例>>Java>>正文


Java AdView.loadAd方法代码示例

本文整理汇总了Java中com.google.android.gms.ads.AdView.loadAd方法的典型用法代码示例。如果您正苦于以下问题:Java AdView.loadAd方法的具体用法?Java AdView.loadAd怎么用?Java AdView.loadAd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.ads.AdView的用法示例。


在下文中一共展示了AdView.loadAd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;

}
 
开发者ID:changja88,项目名称:Udacity_Gradle,代码行数:17,代码来源:MainActivityFragment.java

示例2: onCreate

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MobileAds.initialize(getApplicationContext(), "YOUR UNIT ID");

        AdView adView = (AdView) this.findViewById(R.id.adMob);
        //request TEST ads to avoid being disabled for clicking your own ads
        AdRequest adRequest = new AdRequest.Builder()
                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)// This is for emulators
                //test mode on DEVICE (this example code must be replaced with your device uniquq ID)
//                .addTestDevice("2EAB96D84FE62876379A9C030AA6A0AC") // Nexus 5
                .build();
        adView.loadAd(adRequest);
    }
 
开发者ID:CatalinPrata,项目名称:funcodetuts,代码行数:17,代码来源:MainActivity.java

示例3: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:akarshsingh9,项目名称:CodeInPython,代码行数:18,代码来源:quiz2Fragment.java

示例4: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:akarshsingh9,项目名称:CodeInPython,代码行数:18,代码来源:quiz4Fragment.java

示例5: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:akarshsingh9,项目名称:CodeInPython,代码行数:20,代码来源:quiz12Fragment.java

示例6: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:vixir,项目名称:Perfect-Day,代码行数:17,代码来源:MoreInfoFragment.java

示例7: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:akarshsingh9,项目名称:CodeInPython,代码行数:20,代码来源:quiz15Fragment.java

示例8: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:akarshsingh9,项目名称:CodeInPython,代码行数:18,代码来源:quiz5Fragment.java

示例9: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:akarshsingh9,项目名称:CodeInPython,代码行数:18,代码来源:quiz9Fragment.java

示例10: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:akarshsingh9,项目名称:CodeInPython,代码行数:20,代码来源:quiz11Fragment.java

示例11: onCreateView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:akarshsingh9,项目名称:CodeInPython,代码行数:20,代码来源:quiz13Fragment.java

示例12: onCreate

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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();
}
 
开发者ID:borfast,项目名称:arrispwgen-android,代码行数:19,代码来源:MainActivity.java

示例13: showGoogleAdMobAds

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
private void showGoogleAdMobAds(Activity activity) {

        try {
            AdView adView = new AdView(activity);
            adView.setAdUnitId("ca-app-pub-5619114666968507/6860732934");
            adView.setAdSize(AdSize.BANNER);

            LinearLayout layout = (LinearLayout) activity.findViewById(R.id.adsLayout);
            // Add the adView to it
            layout.addView(adView);
            // Initiate a generic request.
            AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                    .addTestDevice(TESTDEVICE_SGS5)
                    .addTestDevice(TESTDEVICE_SGS3MINI)
                    .addTestDevice(TESTDEVICE_DUOS_Y).build();
            // Load the adView with the ad request.
            adView.loadAd(adRequest);
        } catch (Exception e) {
            Log.e(TAG, "Error while getting ads", e);
        }
    }
 
开发者ID:konir,项目名称:RadioRecPlus,代码行数:22,代码来源:AdMob.java

示例14: onCreate

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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);
}
 
开发者ID:antifriz,项目名称:zetcheck,代码行数:17,代码来源:SlidingStationActivity.java

示例15: onCreate

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@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);
}
 
开发者ID:antifriz,项目名称:zetcheck,代码行数:26,代码来源:MenuActivity.java


注:本文中的com.google.android.gms.ads.AdView.loadAd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。