Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. // The app consists of MainActivity.java and SearchResultFragment.java at which I don't want to show Ads and few other fragemnt with Ads.
  2. // The Appodeal bottom banner is handled only in the Activity.
  3. // In onCreate() method there is initilization:
  4.  
  5. Appodeal.initialize(this, appKey, Appodeal.INTERSTITIAL | Appodeal.BANNER_BOTTOM);
  6.  
  7. // and then call for showing bottom banner
  8.  
  9. Appodeal.show(this, Appodeal.BANNER_BOTTOM);
  10.  
  11. // in onResume I call:
  12.  
  13. Appodeal.onResume(this, Appodeal.BANNER_BOTTOM);
  14.  
  15. // 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)
  16.  
  17. public void showAds() {
  18. Appodeal.show(this, Appodeal.BANNER_BOTTOM);
  19. }
  20.  
  21. public void hideAds() {
  22. Appodeal.hide(this, Appodeal.BANNER_BOTTOM);
  23. }
  24.  
  25. // For the SearchResultFragment itself in Oncreate I'm hiding the ads:
  26.  
  27. ((MainActivity) getActivity()).hideAds();
  28.  
  29. // In onStop method I'm trying to show the ads:
  30.  
  31. ((MainActivity) getActivity()).showAds();
  32.  
  33.  
  34. // To sum up, ads are hiding, but after that, calling showsAds(); does not seem to work (it is invoked though).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement