StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectAll() .penaltyLog() .build());
@Override public void onCreate() { super.onCreate(); setThreadPolicy(new ThreadPolicy.Builder().detectAll().penaltyLog().build()); setVmPolicy(new VmPolicy.Builder().detectAll().penaltyLog().build()); } }
@Override public void onCreate() { super.onCreate(); Log.d(TAG, "onCreate start"); if (BuildConfig.DEBUG) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); } applicationComponent = DaggerApplicationComponent.builder() .applicationModule(new ApplicationModule(this)) .build(); //初始化Stetho BuildConfig.STETHO.init(this.getApplicationContext()); weatherApplicationInstance = this; //初始化ApiClient ApiConfiguration apiConfiguration = ApiConfiguration.builder() // .dataSourceType(ApiConstants.WEATHER_DATA_SOURCE_TYPE_MI) // .dataSourceType(ApiConstants.WEATHER_DATA_SOURCE_TYPE_KNOW) .dataSourceType(ApiConstants.WEATHER_DATA_SOURCE_TYPE_ENVIRONMENT_CLOUD) .build(); ApiClient.init(apiConfiguration); Log.d(TAG, "onCreate end"); }
private void enableStrictMode() { StrictMode.setThreadPolicy( new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites() .detectNetwork().penaltyLog().build()); StrictMode.setVmPolicy( new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().penaltyLog() .penaltyDeath().build()); }
@Override protected void onCreate(Bundle savedInstanceState) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Flaggr flaggr = Flaggr.with(this); flaggr.init("MY_URL", "MY_LOCAL_URI", null); } }
private void setupStrictMode() { if (Config.debugStrictMode) { StrictMode.setThreadPolicy( new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork() //.penaltyDeath() .penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects() .detectLeakedClosableObjects().penaltyLog() // .penaltyDeath() .build()); } }
private static StrictMode.ThreadPolicy.Builder newThreadPolicyBuilder() { return new StrictMode.ThreadPolicy.Builder() .detectCustomSlowCalls() .penaltyLog(); }
private void enabledStrictMode() { if (SDK_INT >= GINGERBREAD) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() // .detectAll() // .penaltyLog() // .penaltyDeath() // .build()); } } }
@Override public void run() { StrictMode.setThreadPolicy( new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); } });
private void setStrictMode() { if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); } }
private void enabledStrictMode() { if (SDK_INT >= GINGERBREAD) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() // .detectAll() // .penaltyLog() // .penaltyDeath() // .build()); } } // 获取ApplicationContext
.detectDiskWrites() .penaltyLog() .build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectDiskWrites() .penaltyLog() .build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectDiskWrites() .penaltyLog() .build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
@Override public void onCreate() { super.onCreate(); if (BuildConfig.DEBUG) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectAll() .penaltyLog() .penaltyDeath() .build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectAll() .penaltyLog() .penaltyDeath() .build()); } Once.initialise(this); } }
private void initStrictMode() { if (BuildConfig.DEBUG) { StrictMode.setThreadPolicy( new StrictMode.ThreadPolicy.Builder() .detectAll() // .penaltyDialog() // 弹出违规提示对话框 .penaltyLog() // 在logcat中打印违规异常信息 .build()); StrictMode.setVmPolicy( new StrictMode.VmPolicy.Builder() .detectAll() .penaltyLog() .build()); } }
@Override public void onCreate() { super.onCreate(); refWatcher = LeakCanary.install(this); StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() .detectNetwork() // or .detectAll() for all detectable problems .penaltyLog() .build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectLeakedSqlLiteObjects() .detectLeakedClosableObjects() .penaltyLog() .penaltyDeath() .build()); // If using Android-Universal-Image-Loader // Create global configuration and initialize ImageLoader with default config // ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build(); // ImageLoader.getInstance().init(config); } }
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectAll() .penaltyLog() .build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectAll() .penaltyLog() .penaltyDeath() .build()); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GetOrComputeYearClass findYearClass = new GetOrComputeYearClass(); findYearClass.execute(); mYearClass = (TextView) findViewById(R.id.year_class); }
@Override public void onCreate() { super.onCreate(); Stetho.initializeWithDefaults(this); if (BuildConfig.DEBUG) { StrictMode.setThreadPolicy( new StrictMode.ThreadPolicy.Builder() .detectAll() .penaltyLog() .penaltyDeath() .build()); StrictMode.setVmPolicy( new StrictMode.VmPolicy.Builder() .detectAll() .penaltyLog() .penaltyDeath() .build()); } JobManager.create(this).addJobCreator(new DemoJobCreator()); } }
private static void enabledStrictMode() { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() // .detectAll() // .penaltyLog() // .penaltyDeath() // .build()); } }