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


Java AdView类代码示例

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


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

示例1: onCreateView

import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.photo_layout, container, false);
    mCloseAdView = rootView.findViewById(R.id.title);
    mCloseAdView.setOnClickListener(this);
    // TextView des = (TextView) rootView.findViewById(R.id.des);
    // des.setText(mDes);
    mAdView = (AdView) rootView.findViewById(R.id.adView);
    mAdView.setAdListener(this);
    NetworkPhotoView photoView = (NetworkPhotoView) rootView.findViewById(R.id.photo);
    photoView.setOnSetImageBitmap(this);
    photoView.setErrorImageResId(R.drawable.ic_error);
    photoView.setDefaultImageResId(R.drawable.ic_default);
    photoView.setImageUrl(mUrl, App.getImageLoader());
    mPhotoView = photoView;
    return rootView;
}
 
开发者ID:goodev,项目名称:android-discourse,代码行数:18,代码来源:PhotoFragment.java

示例2: onCreateView

import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View rootView = inflater.inflate(
			R.layout.fragment_number_practice_dummy, container, false);
	canvas = (CanvasTextView) rootView
			.findViewById(R.id.numberPracticeCanvas);
	canvas.setText(getArguments().getString(ARG_LETTER));

	AdView adView = (AdView) rootView.findViewById(R.id.ad);
	if (adView != null) {
		adView.loadAd(new AdRequest());
	}

	return rootView;
}
 
开发者ID:omidfi,项目名称:FarsiAlphabet-Android,代码行数:17,代码来源:NumberPracticeActivity.java

示例3: onCreateView

import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(final LayoutInflater inflater,
		final ViewGroup container, Bundle savedInstanceState) {
	rootView = inflater.inflate(R.layout.fragment_word_canvas_dummy,
			container, false);
	wordLetters1 = (TextView) rootView
			.findViewById(R.id.wordLettersCanvas);
	wordLetters2 = (TextView) rootView
			.findViewById(R.id.pronounciationCanvas);
	letterItemsInWords = LettersInWordItem.EXAMPLE_WORDS_LETTERS
			.get(getArguments().getString(ARG_FARSI_WORD));
	if (letterItemsInWords != null && wordLetters1 != null) {
		wordLetters1.setText(createText(letterItemsInWords));
	}

	wordCanvas = (CanvasTextView) rootView
			.findViewById(R.id.wordCanvas);
	wordCanvas.setText(getArguments().getString(ARG_FARSI_WORD));

	AdView adView = (AdView) rootView.findViewById(R.id.ad);
	if (adView != null) {
		adView.loadAd(new AdRequest());
	}

	return rootView;
}
 
开发者ID:omidfi,项目名称:FarsiAlphabet-Android,代码行数:27,代码来源:WordCanvasActivity.java

示例4: onCreate

import com.google.ads.AdView; //导入依赖的package包/类
@Override
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.general_config);
		addPreferencesFromResource(R.xml.general_config);

		mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
		mOpacity = Constants.DEFAULT_OPACITY;  //default
//		mBackgroundColor = Constants.DEFAULT_BACKGROUND_COLOR;
		mShortcutIconSize = mShortcutDefaultIconSzie = getResources().getDimensionPixelSize(Constants.DEFAULT_SHORTCUT_ICON_SIZE_ID);
		try {
			mPackageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
		} catch (NameNotFoundException e) {
			LogUtils.w(TAG, e.getMessage(), e);
		}
		
		findPreference();
		
		mAdView = (AdView) findViewById(R.id.adView);
		AdRequest request = new AdRequest();
//		request.addTestDevice("56D63A77B274B556D00C3D6C4191560C");
//		request.addTestDevice("19C036F0231C3870BF96D723B76E7215");
		mAdView.loadAd(request);
	}
 
开发者ID:newmanchen,项目名称:ShortcutBar,代码行数:26,代码来源:Setting.java

示例5: onCreate

import com.google.ads.AdView; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.layout_listview);
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	lv = (ListView) findViewById(R.id.listView);
	emptyView = View.inflate(BaseListActivity.this, R.layout.empty_list,
			null);
	adView = (AdView) findViewById(R.id.adView);
	adLayout = findViewById(R.id.zzz);

	addContentView(emptyView, new LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT));
	((ImageView) emptyView.findViewById(R.id.imageView1)).setAlpha(0x33);
	lv.setEmptyView(emptyView);
	lv.setOnItemClickListener(this);
	init();
	loadAd();
}
 
开发者ID:razielsarafan,项目名称:lastfm-for-android,代码行数:21,代码来源:BaseListActivity.java

示例6: onCreate

import com.google.ads.AdView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
       try {
           AdView adView = (AdView) this.findViewById(R.id.add);
           AdRequest adRequest = new AdRequest();
           adView.loadAd(adRequest);
       } catch (Exception e) {
           e.printStackTrace();
       }
	if (CallerFlashlight.LOG) Log.d(TAG, "onCreated");
	setContentView(R.layout.first_time);
	callerFlashlight = (CallerFlashlight) getApplication();
	Button testButton = (Button) findViewById(R.id.firstFlashTest);
	testButton.setOnClickListener(this);
	contButton = (Button) findViewById(R.id.firstcontinue);
	contButton.setOnClickListener(this);
	Spinner moduleList = (Spinner) findViewById(R.id.module_list);
	moduleList.setOnItemSelectedListener(this);
	ImageView logo = (ImageView) findViewById(R.id.logo);
	logo.startAnimation(AnimationUtils.loadAnimation(this, R.anim.round));

}
 
开发者ID:futerox,项目名称:FlashAlerts,代码行数:24,代码来源:FirstTimeUtilisation.java

示例7: run

import com.google.ads.AdView; //导入依赖的package包/类
@Override
public void run() {
  if (adSize == null) {
    result = new PluginResult(Status.ERROR, "AdSize is null. Did you use an AdSize constant?");
  } else {
    adView = new AdView(cordova.getActivity(), adSize, publisherId);
    adView.setAdListener(new BannerListener());
    LinearLayoutSoftKeyboardDetect parentView =
        (LinearLayoutSoftKeyboardDetect) webView.getParent();
    if (bannerAtTop) {
      parentView.addView(adView, 0);
    } else {
      parentView.addView(adView);
    }
    // Notify the plugin.
    result = new PluginResult(Status.OK);
  }
  synchronized (this) {
    this.notify();
  }
}
 
开发者ID:psydrake,项目名称:litecoinEasyCheck,代码行数:22,代码来源:AdMob.java

示例8: onCreate

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

	// Get the solution from the intent
	this.solution = this.getIntent().getExtras().getParcelableArrayList(SOLUTION_KEY);
	
	// Add the pages to the ViewPager
	ViewPager pager = (ViewPager) findViewById(R.id.viewPager);  
       pager.setAdapter(new DrawSolutionPageAdapter(this, this.solution));
       
       // Initialize AdMob
    AdView adView = (AdView) findViewById(R.id.adView);
    adView.loadAd(new AdRequest());
}
 
开发者ID:JoseExposito,项目名称:FlingSolver,代码行数:17,代码来源:DrawSolutionActivity.java

示例9: addAdsTo

import com.google.ads.AdView; //导入依赖的package包/类
public void addAdsTo(ViewGroup container) {
    this.mContainer =container;
    mContainer.setVisibility(View.VISIBLE);
    View v = mContainer.findViewById(R.id.ad_banner);
    if(v==null) {

        AdView ad = new AdView(mContext,AdSize.BANNER, mAdUnitId);
        ad.setId(R.id.ad_banner);

        container.removeAllViews();
        ad.setAdListener(this);
        AdRequest request = new AdRequest();
        if(mTestDevices!=null)
            request.setTestDevices(mTestDevices);
        request.addTestDevice(AdRequest.TEST_EMULATOR);
        ad.loadAd(request);
        container.addView(ad);
    }

}
 
开发者ID:MagicMicky,项目名称:FreemiumLibrary,代码行数:21,代码来源:AdsInstantiator.java

示例10: onCreateView

import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    RelativeLayout v = (RelativeLayout) super.onCreateView(inflater, container, savedInstanceState);

    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mHideAds, new IntentFilter(ConstsFree.REMOVE_ADS));
    /**
     * If ads are disabled we don't need to load any
     */
    if (!SharedPreferencesHelperFree.getDisableAds(getActivity())) {
        mAdView = new AdView(getActivity(), AdSize.SMART_BANNER, ConstsFree.ADMOB_ID);

        /**
         * The AdView should be attached to the bottom of the screen, with the GridView position above it
         */
        RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                                                                               ViewGroup.LayoutParams.WRAP_CONTENT);
        adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        v.addView(mAdView, adParams);

        mAdView.loadAd(AdUtil.getAdRequest());
    }

    return v;
}
 
开发者ID:antew,项目名称:RedditInPictures,代码行数:25,代码来源:RedditImageListFragmentFree.java

示例11: onCreateView

import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.pause_layout, container);
    LinearLayout adLayout = (LinearLayout) view.findViewById(R.id.adLayout);

    adView = new AdView(activity, AdSize.BANNER, AdSettings.ADSENSE_ID);
    DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics();
    int width = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, AdSize.BANNER.getWidth(), displayMetrics));
    int height = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, AdSize.BANNER.getHeight(), displayMetrics));
    adLayout.addView(adView, width, height);
    AdRequest adRequest = new AdRequest();
    adRequest.addTestDevice(AdSettings.TEST_DEVICE_ID);
    adView.loadAd(adRequest);

    getDialog().setTitle(R.string.pause_title);

    Button pauseList = (Button) view.findViewById(R.id.pause_button_list);
    Button pauseRestart = (Button) view.findViewById(R.id.pause_button_restart);
    Button pauseContinue = (Button) view.findViewById(R.id.pause_button_continue);

    pauseContinue.setOnClickListener(new OnContinueClickListener());
    pauseList.setOnClickListener(new OnLevelListClickListener());
    pauseRestart.setOnClickListener(new OnRestartClickListener());

    return view;
}
 
开发者ID:tschut,项目名称:drturbo,代码行数:27,代码来源:PauseMenuFragment.java

示例12: addAD

import com.google.ads.AdView; //导入依赖的package包/类
/**
 * AdViewを挿入
 */
private void addAD() {
    // for adView
    //
    adView = new AdView(this, AdSize.BANNER, Conf.MY_AD_UNIT_ID);

    LinearLayout layout = (LinearLayout) findViewById(R.id.admobspace);

    // adView処理 --- ここから
    layout.addView(adView);

    // 広告の読み込み
    AdRequest adRequest = new AdRequest();
    if (BuildConfig.DEBUG) {
        // ここから - できればリリース時にコメントアウト
        // エミュレータ
        adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
        // Android端末をテスト
        // "XXXXXX...XX"には、端末の識別IDを指定(指定したIDの端末には広告は表示されない)
        adRequest.addTestDevice("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
        // ここまで
    }
    adView.loadAd(adRequest);
    // adView処理 --- ここまで

}
 
开发者ID:Kyakujin,项目名称:AutoEco,代码行数:29,代码来源:MainActivity.java

示例13: onCreate

import com.google.ads.AdView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    MainActivity.context = getApplicationContext();
    EditText edit = (EditText) findViewById(R.id.editText1);
    edit.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    EditText edit1 = (EditText) findViewById(R.id.editText2);
    edit1.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    AdView adview = (AdView) findViewById(R.id.adView);
    AdRequest req = new AdRequest();
    adview.loadAd(req);
    mProgress = (ProgressBar) findViewById(R.id.progressBar1);
    mProgress.setVisibility(View.INVISIBLE);

}
 
开发者ID:monsterkitten,项目名称:is.gd,代码行数:17,代码来源:MainActivity.java

示例14: onCreateView

import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View rootView = inflater.inflate(
			R.layout.fragment_letter_practice_dummy, container, false);

	canvas = (CanvasTextView) rootView
			.findViewById(R.id.letterPracticeCanvas);
	canvas.setText(getArguments().getStringArray(ARG_LETTER_PHONOLOGY)[1]);

	phonologyCanvasLetters = (TextView) rootView
			.findViewById(R.id.pronounciationPhonology);

	letterPhonologyItems = LetterPhonologyItem.EXAMPLE_PHONOLOGY_LETTERS
			.get(getArguments().getStringArray(ARG_LETTER_PHONOLOGY)[0]);
	if (letterPhonologyItems != null && phonologyCanvasLetters != null) {
		phonologyCanvasLetters
				.setText(createTextPhonology(letterPhonologyItems));
	}
	// load add
	AdView adView = (AdView) rootView.findViewById(R.id.ad);
	if (adView != null) {
		adView.loadAd(new AdRequest());
	}

	return rootView;
}
 
开发者ID:omidfi,项目名称:FarsiAlphabet-Android,代码行数:28,代码来源:LetterPracticeActivity.java

示例15: onCreate

import com.google.ads.AdView; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    
    RelativeLayout layout = new RelativeLayout(this);
    adView = new AdView(this, AdSize.BANNER, AdMob_Ad_Unit); // Put in your secret key here
    
    View gameView = initializeForView(new AmpelBird(this), cfg);
    
    AdRequest adRequest = new AdRequest();
    adView.loadAd(adRequest);
    
    // Add the libgdx view
    layout.addView(gameView);

    // Add the AdMob view
    RelativeLayout.LayoutParams adParams = 
            new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 
                            RelativeLayout.LayoutParams.WRAP_CONTENT);
    
    adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    
    layout.addView(adView, adParams);
    
    setContentView(layout);
}
 
开发者ID:onatm,项目名称:Ampel-Bird,代码行数:30,代码来源:MainActivity.java


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