Issue
I want when the player clicks on the imageView the ads should show first if its ready and then go to the next activity here is my code
FalgQuizImageView.setOnClickListener {
if (mInterstitialAd != null) {
mInterstitialAd?.show(this)
}
mInterstitialAd?.fullScreenContentCallback = object: FullScreenContentCallback() {
override fun onAdDismissedFullScreenContent() {
val intent = Intent(this, QuizQuestionsCar::class.java)
startActivity(intent)
}
override fun onAdFailedToShowFullScreenContent(adError: AdError?) {
val intent = Intent(this, QuizQuestionsCar::class.java)
startActivity(intent)
}
}
}
Here is the error

Solution
First parameter on Intent constructor is of type Context, you are passing this which in your case refers to the FullScreenContentCallback object and its not of type Context. To fix this do the following
val intent = Intent(this@YourActivityName, QuizQuestionsCar::class.java)
this@YourActivityName refers to your Activity object, which is a Context
Answered By - mightyWOZ
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.