Close an Activity and start another (Intersticial admob)

Asked

Viewed 71 times

1

I have an Interstitial admob on an Activity and when I press a button I put the following lines of code:

botaoid.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (mInterstitialAd.isLoaded()) {
                    mInterstitialAd.show();
                } else {
                    startActivity(new Intent(mainTela.this,telaSecundaria.class));
                }



            }
        });

The problem is that the Interstitial is opening when the screen is being closed, how to make first the Interstitial open and when closed start the screen?

  • 1

    On which screen is this code being placed?

  • @Luc in the mainTela

  • Add the code from the second screen, and also from the first screen, if possible.

  • @Luc realized the mistake, hahaahahah, your question gave me a light, thanks man!

  • You’re welcome, thank you! :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.