ActivityRecord的重复完成请求(当用户关闭部分广告时)

时间:2017-07-15 22:27:22

标签: java android android-logcat

当我在android studio上运行时,这个错误会显示用户关闭时段广告(帮我解决这个问题,或者可以在Playstore上发布应用程序)

W / ActivityManager:ActivityRecord的重复完成请求{7683f03 u0 lawinmyhand.ipcindianpenalcode / com.google.android.gms.ads.AdActivity t138 f}

package lawinmyhand.ipcindianpenalcode.sections;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;


import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest; 
import com.google.android.gms.ads.InterstitialAd;

import lawinmyhand.ipcindianpenalcode.R;

public class s1 extends AppCompatActivity {
InterstitialAd mInterstitialAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_s1);

    overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);


    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    android.support.v7.app.ActionBar actionBar = getSupportActionBar();
    assert actionBar != null;
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);




    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent myIntent = new Intent(Intent.ACTION_SEND);
            myIntent.setType("text/plain");
            String ShareBody = "**Download This App Now**";
            myIntent.putExtra(Intent.EXTRA_SUBJECT, ShareBody);
            myIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_myapp));
            startActivity(Intent.createChooser(myIntent, "share using"));
        }
    });


    mInterstitialAd = new InterstitialAd(this);

    // set the ad unit ID
    mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen));

    AdRequest adRequest = new AdRequest.Builder()
            .build();

    // Load ads into Interstitial Ads
    mInterstitialAd.loadAd(adRequest);

    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            // Code to be executed when an ad finishes loading.
            Log.i("Ads", "onAdLoaded");
            mInterstitialAd.show();
        }

        @Override
        public void onAdFailedToLoad(int errorCode) {
            // Code to be executed when an ad request fails.
            Log.i("Ads", "onAdFailedToLoad");
        }

        @Override
        public void onAdOpened() {
            // Code to be executed when the ad is displayed.
            Log.i("Ads", "onAdOpened");
        }

        @Override
        public void onAdLeftApplication() {
            // Code to be executed when the user has left the app.
            Log.i("Ads", "onAdLeftApplication");
        }

        @Override
        public void onAdClosed() {
            // Code to be executed when when the interstitial ad is closed.
            Log.i("Ads", "onAdClosed");
        }
    });

}



@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case android.R.id.home:
            overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);
            this.finish();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
@Override
public void onBackPressed() {
    super.onBackPressed();
    overridePendingTransition(R.anim.push_right_in,R.anim.push_right_out);
}
}

0 个答案:

没有答案