Code example for Activity

Methods: unregisterReceiver

0
     * @param activity 
     * @param receiver 
     */ 
    public static void tryUnregisterReceiver(Activity activity, BroadcastReceiver receiver) {
        try { 
            activity.unregisterReceiver(receiver);
        } catch (IllegalArgumentException e) {
            // Receiver wasn't registered for some reason 
        } 
    } 
 
    /** 
     * Dismiss a popup window (should call from main thread) 
     * 
     * @param activity 
     * @param popup 
     */ 
    public static void tryDismissPopup(Activity activity, final PopupWindow popup) {
        if (popup == null)
            return; 
        try {