Suppose there is a command, how to make it appear at a certain period of time, for example, once a minute?
Ad.show(this, Ad.INTERSTITIAL); Suppose there is a command, how to make it appear at a certain period of time, for example, once a minute?
Ad.show(this, Ad.INTERSTITIAL); I understand that we are talking about Android. If at once, a couple of solutions:
Runnable task in GUI stream periodically.Judging by the question, you want to display ads periodically or something like that, it means you have to do it in the GUI stream. Then the handler will do.
private static const int DEF_INTERVAL = 500; private int mInterval = DEF_INTERVAL; private Handler mHandler; @Override protected void onCreate(Bundle bundle) { mHandler = new Handler(); startTask(); } Runnable mAdShower = new Runnable() { @Override public void run() { try { Ad.show(this, Ad.INTERSTITIAL); } finally { mHandler.postDelayed(mAdShower , mInterval); } } }; void startTask() { mAdShower.run(); } void stopTask() { mHandler.removeCallbacks(mAdShower); } Source: https://ru.stackoverflow.com/questions/539948/
All Articles