private void insertNewsType( NewsTypeItemDaoImpl newsTypeItemDao, LinkedList<NewsTypeItem> typeItems) { if (null != typeItems) { boolean returnFlag = newsTypeItemDao.insertNewsTypeItems(typeItems); returnFlag = true; // 执行完成 mPreferences.edit().putBoolean(PREF_FIRST_INSERT_NEWS_TYPE, returnFlag).commit(); if (returnFlag) { System.out.println("插入 新闻类型 成功"); } else { System.out.println("插入 新闻类型 失败"); } } }
protected void onResume() { super.onResume(); JPushInterface.onResume(this); LinkedList<NewsTypeItem> typeItems = NewsTypeItem.getNewsTypeItems(this); NewsTypeItemDaoImpl newsTypeItemDao = new NewsTypeItemDaoImpl(new DBHelper(this)); boolean update = (null == newsTypeItemDao.getNewsTypeItems() || (typeItems != null && newsTypeItemDao.getNewsTypeItems().size() != typeItems.size())); if (update || !mPreferences.contains(PREF_FIRST_INSERT_IMG_URL) || !mPreferences.getBoolean(PREF_FIRST_INSERT_IMG_URL, false)) { insertImgUrls(); } if (update || !mPreferences.contains(PREF_FIRST_INSERT_NEWS_TYPE) || !mPreferences.getBoolean(PREF_FIRST_INSERT_NEWS_TYPE, false)) { insertNewsType(newsTypeItemDao, typeItems); } GoogleApplication.mIsOnlyAndroid = mPreferences.getBoolean(PREF_ONLY_ANDROID, false); GoogleApplication.mIsExactBus = mPreferences.getBoolean(PREF_EXACT_BUS, false); }