@Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setRetainInstance(true); mQuery = getArguments().getString(QUERY); mDbManager = new DatabaseManager(getActivity()); mPsyItemsCursor = mDbManager.searchTopics(mQuery); shpm = new SharedPrefrencesManager(getActivity()); mParentalAccess = shpm.getParentalControlAcceess(); isPurchased = shpm.isPurchased(); while (!mPsyItemsCursor.isAfterLast()) { PsyItem item = new PsyItem(); item.setId(mPsyItemsCursor.getInt(mPsyItemsCursor.getColumnIndexOrThrow("_id"))); item.setCategoryId( mPsyItemsCursor.getInt(mPsyItemsCursor.getColumnIndexOrThrow("category_id"))); item.setTitle(mPsyItemsCursor.getString(mPsyItemsCursor.getColumnIndexOrThrow("title"))); item.setIsFavorite(mPsyItemsCursor.getInt(mPsyItemsCursor.getColumnIndexOrThrow("favorate"))); item.setIsNew(mPsyItemsCursor.getInt(mPsyItemsCursor.getColumnIndexOrThrow("new"))); item.setIsFree(mPsyItemsCursor.getInt(mPsyItemsCursor.getColumnIndexOrThrow("free"))); mPsyItems.add(item); mPsyItemsCursor.moveToNext(); } }
@Override public void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); mPsyItemsCursor.close(); mDbManager.close(); }