Skip to content

Instantly share code, notes, and snippets.

@rafalniski
Last active January 23, 2017 10:40
Show Gist options
  • Save rafalniski/7ae5cc2341fb039b58c3afe1f62aef67 to your computer and use it in GitHub Desktop.
Save rafalniski/7ae5cc2341fb039b58c3afe1f62aef67 to your computer and use it in GitHub Desktop.
// The app consists of MainActivity.java and SearchResultFragment.java at which I don't want to show Ads and few other fragemnt with Ads.
// The Appodeal bottom banner is handled only in the Activity.
// In onCreate() method there is initilization:
Appodeal.initialize(this, appKey, Appodeal.INTERSTITIAL | Appodeal.BANNER_BOTTOM);
// and then call for showing bottom banner
Appodeal.show(this, Appodeal.BANNER_BOTTOM);
// in onResume I call:
Appodeal.onResume(this, Appodeal.BANNER_BOTTOM);
// In MainActivity I created public methods for showing/hiding apps (I know that interface is better option, but it also don;t work this way)
public void showAds() {
Appodeal.show(this, Appodeal.BANNER_BOTTOM);
}
public void hideAds() {
Appodeal.hide(this, Appodeal.BANNER_BOTTOM);
}
// For the SearchResultFragment itself in Oncreate I'm hiding the ads:
((MainActivity) getActivity()).hideAds();
// In onStop method I'm trying to show the ads:
((MainActivity) getActivity()).showAds();
// To sum up, ads are hiding, but after that, calling showsAds(); does not seem to work (it is invoked though).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment