Last active
May 8, 2019 20:20
-
-
Save pszklarska/10383a699d5d6a35c0a3cf98d5bf9fdb to your computer and use it in GitHub Desktop.
This file contains 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; | |
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