Code example for ReferenceQueue

0
    Bitmap.NativeWrapper mNativeWrapper;
 
    private static int sSerial = 100;
    private static ArrayList sPhantomList = new ArrayList<PhantomWrapper>();
    private static ReferenceQueue<PhantomWrapper> sPhantomQueue =
            new ReferenceQueue<PhantomWrapper>();
    private static BitmapWatcher sWatcher = new BitmapWatcher(sPhantomQueue);
    static { 
        sWatcher.start();
    }; 
 
    Bitmap(String name, int width, int height, Bitmap.NativeWrapper nativeData) {
        mName = name;
        mWidth = width;
        mHeight = height;
        mNativeWrapper = nativeData;
 
        System.out.println("Created " + this);
    } 
 
    public String toString() {