Skip to content

Instantly share code, notes, and snippets.

@shikto1
Created January 11, 2020 13:28
Show Gist options
  • Select an option

  • Save shikto1/47311b1002064682bb7aac6ef45baf9b to your computer and use it in GitHub Desktop.

Select an option

Save shikto1/47311b1002064682bb7aac6ef45baf9b to your computer and use it in GitHub Desktop.
public class StaticReferenceLeakActivity extends AppCompatActivity {
/*
* This is a bad idea!
*/
private static TextView textView;
private static Activity activity;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
textView = findViewById(R.id.activity_text);
textView.setText("Bad Idea!");
activity = this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment