I installed Proetk LeackCanary in your library. He discovered a memory leak and gave me information about it, but I cannot understand it, because I do not have such practice in the classroom. How to understand exactly where the error is and how to fix it? Thanks.
public final class Activity extends AppCompatActivity {
InterstitialAd mInterstitialAd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fci); getWindow().setBackgroundDrawable(null); final ImageButton btn_pas = (ImageButton) findViewById(R.id.btn_pas); Glide.with(getApplicationContext()).load(R.drawable.fci_2).placeholder(R.color.white).into(btn_pas); mInterstitialAd = new InterstitialAd(this); mInterstitialAd.setAdUnitId("ca-app-pub-..."); requestNewInterstitial(); } @Override public void onBackPressed() { if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); super.onBackPressed(); } else { super.onBackPressed(); } requestNewInterstitial(); } private final void requestNewInterstitial() { AdRequest adRequest = new AdRequest.Builder().build(); mInterstitialAd.loadAd(adRequest); } public final void pas(View view) { Intent intent = new Intent(Activity.this, pas.class); startActivity(intent); }
}
I canβt attach the screenshot, so Iβll describe the LeakCanary entry.
static hk.o references ht.a leaks Activity instance
java android memory-leaks leakcanary
Denis
source share