This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HandlersReferenceLeakActivity extends AppCompatActivity { | |
private TextView textView; | |
/* | |
* Mistake Number 1 | |
* */ | |
private Handler leakyHandler = new Handler(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HandlersReferenceLeakActivity extends AppCompatActivity { | |
private TextView textView; | |
/* | |
* Fix number I | |
* */ | |
private final LeakyHandler leakyHandler = new LeakyHandler(this); | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ThreadReferenceLeakActivity extends AppCompatActivity { | |
/* | |
* Mistake Number 1: Do not use static variables | |
* */ | |
private static LeakyThread thread; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ThreadReferenceLeakActivity extends AppCompatActivity { | |
/* | |
* FIX I: make variable non static | |
* */ | |
private LeakyThread leakyThread = new LeakyThread(); | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TimerTaskReferenceLeakActivity extends Activity { | |
private CountDownTimer countDownTimer; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_first); | |
startTimer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TimerTaskReferenceLeakActivity extends Activity { | |
private CountDownTimer countDownTimer; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_first); | |
startTimer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Step I: Add the below line | |
apply plugin: 'com.novoda.bintray-release' | |
apply plugin: 'com.android.library' | |
//Step II: Add the below publish details | |
publish { | |
def groupProjectID = 'com.an.optimize' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:3.1.0-alpha07' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.novoda.bintray-release' | |
apply plugin: 'com.android.library' | |
// Step 1: Add the below plugin | |
apply plugin: 'maven-publish' | |
publish { | |
def groupProjectID = 'com.an.optimize' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { | |
/* | |
* | |
*/ | |
setupSlideScrollView(slides: slides) | |
} | |