private static void setShowFriendsView() {
   // Show friends view if necessary
   boolean showFriends = false;
   TodorooCursor<User> users = PluginServices.getUserDao().query(Query.select(User.ID).limit(1));
   try {
     showFriends = users.getCount() > 0;
   } finally {
     users.close();
   }
   Preferences.setBoolean(R.string.p_show_friends_view, showFriends);
 }
 private static NowBriefed<?> instantiateNowBriefed(JSONObject json) {
   String table = json.optString("table");
   if (NameMaps.TABLE_ID_TASKS.equals(table))
     return new NowBriefed<Task>(json, PluginServices.getTaskDao());
   else if (NameMaps.TABLE_ID_TAGS.equals(table))
     return new NowBriefed<TagData>(json, PluginServices.getTagDataDao());
   else if (NameMaps.TABLE_ID_USER_ACTIVITY.equals(table))
     return new NowBriefed<UserActivity>(json, PluginServices.getUserActivityDao());
   else if (NameMaps.TABLE_ID_USERS.equals(table))
     return new NowBriefed<User>(json, PluginServices.getUserDao());
   else if (NameMaps.TABLE_ID_ATTACHMENTS.equals(table))
     return new NowBriefed<TaskAttachment>(json, PluginServices.getTaskAttachmentDao());
   else if (NameMaps.TABLE_ID_TASK_LIST_METADATA.equals(table))
     return new NowBriefed<TaskListMetadata>(json, PluginServices.getTaskListMetadataDao());
   else return null;
 }