Skip to content

Instantly share code, notes, and snippets.

@pszklarska
Last active May 8, 2019 20:20
Show Gist options
  • Save pszklarska/10383a699d5d6a35c0a3cf98d5bf9fdb to your computer and use it in GitHub Desktop.
Save pszklarska/10383a699d5d6a35c0a3cf98d5bf9fdb to your computer and use it in GitHub Desktop.
package pl.pszklarska.leakexample;
import android.content.Context;
import android.widget.Toast;
public class StaticContextLeak {
private static Context context;
public void setContext(final Context context) {
this.context = context;
}
private static void showToast(String text) {
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment