本文整理匯總了Java中com.google.android.gms.ads.AdView.destroy方法的典型用法代碼示例。如果您正苦於以下問題:Java AdView.destroy方法的具體用法?Java AdView.destroy怎麽用?Java AdView.destroy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.ads.AdView
的用法示例。
在下文中一共展示了AdView.destroy方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: destroyAd
import com.google.android.gms.ads.AdView; //導入方法依賴的package包/類
public static void destroyAd(Activity activity) {
if (!AD_ENABLED) {
return;
}
View adLayout = activity == null ? null : activity.findViewById(R.id.ad_layout);
if (adLayout != null) {
AdView adView = (AdView) adLayout.findViewById(R.id.ad);
if (adView != null) {
try {
adView.removeAllViews();
adView.destroy();
} catch (Throwable t) {
MTLog.w(TAG, t, "Error while destroying ad view!");
}
}
}
adLoaded = null;
TaskUtils.cancelQuietly(setupAdTask, true);
setupAdTask = null;
}
示例2: onDestroy
import com.google.android.gms.ads.AdView; //導入方法依賴的package包/類
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
if (bp != null) {
bp.release();
}
if (!Monetize.isAdsRemoved()) {
for (AdView adView : adViewTiers) {
if (adView != null) {
adView.destroy();
}
}
}
}
示例3: destroyAdView
import com.google.android.gms.ads.AdView; //導入方法依賴的package包/類
public void destroyAdView(int id, Activity activity) {
AdView adView = window.getAdView(id, activity);
if (adView != null) {
adView.destroy();
Log.d(TAG, "ad destroyed");
}
}
示例4: onPurchasesUpdated
import com.google.android.gms.ads.AdView; //導入方法依賴的package包/類
@Override
public void onPurchasesUpdated(@BillingClient.BillingResponse int responseCode, List<Purchase> purchases) {
if (responseCode == BillingClient.BillingResponse.OK && purchases != null) {
if(getView() != null) {
// Apply preference
SharedPreferences settings = getActivity().getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("donationPurchased", true);
editor.apply();
// Destroy Ad
AdView mAdView = getActivity().findViewById(R.id.adView);
mAdView.setVisibility(GONE);
mAdView.destroy();
showDonatorStatus();
}
} else if (responseCode == BillingClient.BillingResponse.USER_CANCELED) {
// Handle an error caused by a user cancelling the purchase flow.
if(getView() != null) {
Snackbar.make(getView(), R.string.donation_cancelled, Snackbar.LENGTH_SHORT).show();
}
} else {
// Handle any other error codes.
if(getView() != null) {
Snackbar.make(getView(), R.string.donation_cancelled, Snackbar.LENGTH_SHORT).show();
}
}
}
示例5: onDestroy
import com.google.android.gms.ads.AdView; //導入方法依賴的package包/類
public void onDestroy() {
for (AdView adView : adViewList) {
adView.destroy();
}
compositeDisposable.clear();
}