I /编舞:跳过47帧!该应用程序可能在其主线程上做过多的工作

时间:2018-12-10 10:50:42

标签: android

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.main);

    buttonToDescription = (Button) findViewById(R.id.button2);

    Runnable r = () -> {
        MobileAds.initialize(this, APP_ID);
    };

    Thread t = new Thread(r);
    t.start();

    prepareAd();


    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            if (isNextPressed) {
                startActivity(new Intent(Main.this, Description.class));
            } else{
                startActivity(new Intent(Main.this, Download.class));
            }
        }}
    );

准备的广告是:

public void prepareAd() {
        mInterstitialAd = new InterstitialAd(this);
        mInterstitialAd.setAdUnitId(INTERSTITIAL_ID);
        mInterstitialAd.loadAd(new AdRequest.Builder().build());
    }

因此,我不进行任何计算/与数据库的连接/任何耗时的操作或主线程UI阻塞操作。为什么我可能会有这个问题?

0 个答案:

没有答案