Android – startapp insert ads are not displayed in oncreate

This is in oncreate:

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    StartAppAd.init(this, "devID", "appID");
    setContentView(R.layout.activity_results);

    startAppAd.showAd();
    startAppAd.loadAd();
}           

And it doesn't display ads, but if I change it to:

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    StartAppAd.init(this, "devID", "appID");
    setContentView(R.layout.activity_results);

    new Handler().postDelayed(new Runnable()
    {
        @Override
        public void run()
        {
            startAppAd.showAd();
            startAppAd.loadAd();
        }
    }, 2000);

}

Useful. How to display the advertisement immediately after it is ready?

resolvent:

I solved this problem by simply putting loadad(); Oncreate and showad() in the previous activity; In my startintent(); Before

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>