IT. Expert System.

Android Reference

StrictMode.VmPolicy.Builder


android.os

Class StrictMode.VmPolicy.Builder

  • Enclosing class:
    StrictMode.VmPolicy


    public static final class StrictMode.VmPolicy.Builder
    extends Object
    Creates StrictMode.VmPolicy instances. Methods whose names start with detect specify what problems we should look for. Methods whose names start with penalty specify what we should do when we detect a problem.

    You can call as many detect and penalty methods as you like. Currently order is insignificant: all penalties apply to all detected problems.

    For example, detect everything and log anything that's found:

     StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder()
         .detectAll()
         .penaltyLog()
         .build();
     StrictMode.setVmPolicy(policy);
     
    • Constructor Detail

      • StrictMode.VmPolicy.Builder

        public StrictMode.VmPolicy.Builder()
      • StrictMode.VmPolicy.Builder

        public StrictMode.VmPolicy.Builder(StrictMode.VmPolicy base)
        Build upon an existing VmPolicy.
    • Method Detail

      • setClassInstanceLimit

        public StrictMode.VmPolicy.Builder setClassInstanceLimit(Class klass,
                                                        int instanceLimit)
        Set an upper bound on how many instances of a class can be in memory at once. Helps to prevent object leaks.
      • detectAll

        public StrictMode.VmPolicy.Builder detectAll()
        Detect everything that's potentially suspect.

        In the Honeycomb release this includes leaks of SQLite cursors, Activities, and other closable objects but will likely expand in future releases.

      • detectLeakedSqlLiteObjects

        public StrictMode.VmPolicy.Builder detectLeakedSqlLiteObjects()
        Detect when an SQLiteCursor or other SQLite object is finalized without having been closed.

        You always want to explicitly close your SQLite cursors to avoid unnecessary database contention and temporary memory leaks.

      • detectLeakedClosableObjects

        public StrictMode.VmPolicy.Builder detectLeakedClosableObjects()
        Detect when an Closeable or other object with a explict termination method is finalized without having been closed.

        You always want to explicitly close such objects to avoid unnecessary resources leaks.

      • penaltyDeath

        public StrictMode.VmPolicy.Builder penaltyDeath()
        Crashes the whole process on violation. This penalty runs at the end of all enabled penalties so yo you'll still get your logging or other violations before the process dies.
      • penaltyDropBox

        public StrictMode.VmPolicy.Builder penaltyDropBox()
        Enable detected violations log a stacktrace and timing data to the DropBox on policy violation. Intended mostly for platform integrators doing beta user field data collection.
      • build

        public StrictMode.VmPolicy build()
        Construct the VmPolicy instance.

        Note: if no penalties are enabled before calling build, penaltyLog() is implicitly set.



Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 47 / 158780194. Delta: 0.03746 с