rxdroid
rxdroid copied to clipboard
Activity memory leak caused by the anonymous thread
An anonymous inner class will hold a reference to the this pointer of the outer class and will not be released until the thread ends. It will hold the Activity and prevent its timely release.
In DrugListActivity2.java, there is a timed task. It can be improved by TimerTask elegantly and efficiently.
timer =
timerTask = timerTask(){
run(){
}
}
timer.schedule(timerTask,10,1100);
onDestroy(){
timer.cancel();
}