Code example for WeakReference

Methods: clear

0
        return _context;
    } 
 
 
    public void setView(T view) {
        _weakView.clear();
 
        _weakView = new WeakReference<T>(view);
    } 
 
    protected void openActivity(Class<? extends Activity> clazz) {
        openActivity(clazz, 0);
    } 
 
    protected void openActivity(Class<? extends Activity> clazz, int flags) {
        // Activate an intent from a Class while still being decoupled from the UI context. Much safer. 
        Package p = clazz.getPackage();
        String name = clazz.getName();
 
        ComponentName cn = new ComponentName(p.getName(), name);