public static void setCurrentBlogAndSetVisible(int id) {
    setCurrentBlog(id);

    if (currentBlog != null && currentBlog.isHidden()) {
      wpDB.setDotComBlogsVisibility(id, true);
    }
  }
 private static void attemptToRestoreLastActiveBlog() {
   if (setCurrentBlogToLastActive() == null) {
     // fallback to just using the first blog
     List<Map<String, Object>> accounts = WordPress.wpDB.getVisibleBlogs();
     if (accounts.size() > 0) {
       int id = Integer.valueOf(accounts.get(0).get("id").toString());
       setCurrentBlog(id);
       wpDB.updateLastBlogId(id);
     }
   }
 }
 @Override
 public void onItemSelected(IcsAdapterView<?> arg0, View arg1, int position, long arg3) {
   // http://stackoverflow.com/questions/5624825/spinner-onitemselected-executes-when-it-is-not-suppose-to/5918177#5918177
   if (!mBlogSpinnerInitialized) {
     mBlogSpinnerInitialized = true;
   } else {
     WordPress.setCurrentBlog(blogIDs[position]);
     updateMenuDrawer();
     onBlogChanged();
   }
 }
  /**
   * Set the last active blog as the current blog.
   *
   * @return the current blog
   */
  public static Blog setCurrentBlogToLastActive() {
    List<Map<String, Object>> accounts = WordPress.wpDB.getVisibleBlogs();

    int lastBlogId = WordPress.wpDB.getLastBlogId();
    if (lastBlogId != -1) {
      for (Map<String, Object> account : accounts) {
        int id = Integer.valueOf(account.get("id").toString());
        if (id == lastBlogId) {
          setCurrentBlog(id);
          return currentBlog;
        }
      }
    }
    // Previous active blog is hidden or deleted
    currentBlog = null;
    return null;
  }