Hello, i'm new, and guess i really need help now. I don't know how i can call method from activity class in other non-activity class (my main class GameScreen). Coz i need to show interstitial ad in the end of level.
1. I have an Activity class in this class: public class AndroidLauncher extends AndroidApplication implements IActivityRequestHandler
in this class i loading interstitial ad.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("ca-app-pub-9506272630021404/5753886777");
AdRequest adRequesti = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("0123456789ABCDEF")
.build();
interstitial.loadAd(adRequesti);
And have method displayInterstitial()
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
2.I have GameScreen class in this class: public class GameScreen implements Screen
in this class i have method isWin(), where i want to show interstitial ad (by calling displayInterstitial())
Please help, how can i call displayInterstitial() (activity class method) from GameScreen class (non-activity method). Thanks a lot.