Skip to content

Instantly share code, notes, and snippets.

View anitaa1990's full-sized avatar
🎯
Focusing

Anitaa Murthy anitaa1990

🎯
Focusing
  • Chennai
View GitHub Profile
public class HandlersReferenceLeakActivity extends AppCompatActivity {
private TextView textView;
/*
* Mistake Number 1
* */
private Handler leakyHandler = new Handler();
public class HandlersReferenceLeakActivity extends AppCompatActivity {
private TextView textView;
/*
* Fix number I
* */
private final LeakyHandler leakyHandler = new LeakyHandler(this);
@Override
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);
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);
public class TimerTaskReferenceLeakActivity extends Activity {
private CountDownTimer countDownTimer;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
startTimer();
public class TimerTaskReferenceLeakActivity extends Activity {
private CountDownTimer countDownTimer;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
startTimer();
//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'
// 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'
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'
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
/*
*
*/
setupSlideScrollView(slides: slides)
}