0
Hi, I’m trying to get that button "X" close the ad appear after 15 seconds.
I don’t know the correct function for this but I did it on the basis of appearing interstitial ads from admob.
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 showing after 15 seconds. How to proceed?
I do not understand why they denied my question and left no comment!
– user41630
Missing call the method start() after the creation of the task Tempocorrido
– Edson Santos
Can you give me an example? I’m beginner and not java manjo yet, I did these things seeing tutorial.
– user41630