Every time I create new Thread it is being added to main ThreadGroup and even I null the thread it still exists in main ThreadGroup causing Memory Leak. please help
Updated
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d("mThread", "Surface Destroyed Called");
getHolder().removeCallback(this);
boolean retry = true;
_thread.setRunning(false);
while (retry) {
try {
Log.d("mThread", "b4 Interrupted");
_thread.interrupt();
Log.d("mThread", "b4 thread group Interrupted");
_thread.getThreadGroup().interrupt();
Log.d("mThread", "b4 join");
_thread.join();
retry = false;
} catch (InterruptedException e) {
Log.d("mThread", "Interrupted");
Thread.currentThread().interrupt();
_thread.getThreadGroup().list();
_thread = null;//======>here nulling thread
break;
}
}
}