Created
August 15, 2019 17:06
-
-
Save heytherewill/27b1e67c844277df5b25e6e4e18459ce 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
using Android.App; | |
using Android.OS; | |
using Android.Support.Design.Widget; | |
using Android.Support.V7.App; | |
namespace LeakTest | |
{ | |
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme.NoActionBar", MainLauncher = true)] | |
public class MainActivity : AppCompatActivity | |
{ | |
protected override void OnCreate(Bundle savedInstanceState) | |
{ | |
base.OnCreate(savedInstanceState); | |
SetContentView(Resource.Layout.activity_main); | |
StrictMode.SetVmPolicy( | |
new StrictMode.VmPolicy.Builder() | |
.DetectActivityLeaks() | |
.DetectLeakedClosableObjects() | |
.DetectLeakedRegistrationObjects() | |
.DetectLeakedSqlLiteObjects() | |
.PenaltyLog() | |
.Build()); | |
StrictMode.SetThreadPolicy( | |
new StrictMode.ThreadPolicy.Builder() | |
.DetectCustomSlowCalls() | |
.PenaltyLog() | |
.Build()); | |
FindViewById<FloatingActionButton>(Resource.Id.fab).Click += delegate | |
{ | |
StartActivity(typeof(LeakingActivity)); | |
}; | |
} | |
} | |
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme.NoActionBar")] | |
public class LeakingActivity : AppCompatActivity | |
{ | |
protected override void OnCreate(Bundle savedInstanceState) | |
{ | |
base.OnCreate(savedInstanceState); | |
SetContentView(Resource.Layout.activity_main); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment