From: gumartinm Date: Sun, 17 Jun 2012 03:23:14 +0000 (+0200) Subject: FIX: Reload list if there are changes, remove ads. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=70a13051d63cd310dc9ab17eb6935933e5b92ae0;p=JavaForFun FIX: Reload list if there are changes, remove ads. --- diff --git a/Android/MobiAdsTabs/src/de/android/mobiads/MobiAdsPreferences.java b/Android/MobiAdsTabs/src/de/android/mobiads/MobiAdsPreferences.java index 5033dfb..e717474 100644 --- a/Android/MobiAdsTabs/src/de/android/mobiads/MobiAdsPreferences.java +++ b/Android/MobiAdsTabs/src/de/android/mobiads/MobiAdsPreferences.java @@ -11,12 +11,17 @@ import android.preference.PreferenceFragment; public class MobiAdsPreferences extends PreferenceFragment { - @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference("service_started"); checkBoxPreference.setChecked(isMyServiceRunning()); diff --git a/Android/MobiAdsTabs/src/de/android/mobiads/list/MobiAdsList.java b/Android/MobiAdsTabs/src/de/android/mobiads/list/MobiAdsList.java index 94daec8..2d76af8 100644 --- a/Android/MobiAdsTabs/src/de/android/mobiads/list/MobiAdsList.java +++ b/Android/MobiAdsTabs/src/de/android/mobiads/list/MobiAdsList.java @@ -190,14 +190,14 @@ public class MobiAdsList extends Activity { AdsEntryAdapter mAdapter; // If non-null, this is the current filter the user has provided. String mCurFilter; - + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView listView = getListView(); - getActivity().registerForContextMenu(listView); + registerForContextMenu(listView); listView.setOnItemClickListener(new OnItemClickListener() { @@ -221,8 +221,10 @@ public class MobiAdsList extends Activity { setListShown(false); // Prepare the loader. Either re-connect with an existing one, - // or start a new one. - getLoaderManager().initLoader(0, null, this); + // or start a new one. + //TODO: reload just if there are changes in the data base :/ + //getLoaderManager().initLoader(0, null, this); + getLoaderManager().restartLoader(0, null, this); } @Override