Last active
June 17, 2017 15:31
-
-
Save pszklarska/6fbd3b7485b8077925a80ebf47f7fa40 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package pl.pszklarska.leakexample; | |
public class AnonymousClassLeakActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(@Nullable final Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
new AsyncTask<Void, Void, Void>() { | |
@Override | |
protected Void doInBackground(final Void... voids) { | |
// Here is operation, which takes a long time... | |
Context context = AnonymousClassLeakActivity.this; | |
loadMillionCatsPhotos(context); | |
return null; | |
} | |
}.execute(); | |
} | |
private void loadMillionCatsPhotos(Context context) { | |
// Cat 1 loading... | |
// Cat 2 loading... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment