Hello, I'm trying to get the " X " button to close the ad after 15 seconds.
I do not know the correct function for this anymore I did based on the time admob interstitial ads appear.
See my code:
MobileAds.initialize(getApplicationContext(), getString(R.string.ID_APP_ADMOB));
final LinearLayout adscontainer = (LinearLayout) findViewById(R.id.adsContainer);
final AdView mAdView = (AdView) findViewById(R.id.adView);
final Button closeAd = (Button) findViewById(R.id.closeAd);
final FrameLayout frameAds = (FrameLayout) findViewById(R.id.frameAds);
AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
///tempo contado em milisegundos
TempoCorrido = new CountDownTimer(15000, 50) {
@Override
public void onTick(long millisUnitFinished) {
TempoMilisegundos = millisUnitFinished;
}
@Override
public void onFinish() {
closeAd.setVisibility(View.VISIBLE); /// Exibi o botão X
}
};
XML :
<Button
android:id="@+id/closeAd"
android:background="@android:drawable/ic_menu_close_clear_cancel"
android:layout_gravity="end"
android:visibility="invisible"
android:layout_width="25dp"
android:layout_height="25dp" />
The problem is that the button is not appearing after 15 seconds. How do I proceed?