Skip to content

Instantly share code, notes, and snippets.

@pszklarska
Last active June 17, 2017 15:32
Show Gist options
  • Save pszklarska/a9fb395031a24c91631ba0d0b101c421 to your computer and use it in GitHub Desktop.
Save pszklarska/a9fb395031a24c91631ba0d0b101c421 to your computer and use it in GitHub Desktop.
package pl.pszklarska.leakexample;
public class InnerClassLeakActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
InnerClass innerClassInstance = new InnerClass();
innerClassInstance.showToast();
}
private class InnerClass {
void showToast() {
new Handler().postDelayed(() -> makeSomeAction(), TimeUnit.MINUTES.toMillis(10));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment