aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPortree-Kid <keith.paterson@gmx.de>2013-03-15 11:48:40 +0100
committerPortree-Kid <keith.paterson@gmx.de>2013-03-15 11:48:40 +0100
commit91671b75572614e2150c747520de4839d34dfc24 (patch)
tree40e5be5fbc299b60362af1ae80d4a9e122902cba
parent999225af93fde7be9e37e51bd9319974decfaaf8 (diff)
downloadcgeo-91671b75572614e2150c747520de4839d34dfc24.zip
cgeo-91671b75572614e2150c747520de4839d34dfc24.tar.gz
cgeo-91671b75572614e2150c747520de4839d34dfc24.tar.bz2
stability issues and errorhandling
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java3
-rw-r--r--main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java17
2 files changed, 14 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index 5bce5e0..e10849a 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -1803,7 +1803,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
@Override
public void onLoadFinished(Loader<SearchResult> arg0, SearchResult searchIn) {
- // The database search was moved into the UI call intentionally. If this is done before the runOnUIThread,
+ // The database search was mowved into the UI call intentionally. If this is done before the runOnUIThread,
// then we have 2 sets of caches in memory. This can lead to OOM for huge cache lists.
if (searchIn != null) {
cacheList.clear();
@@ -1811,6 +1811,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
cacheList.addAll(cachesFromSearchResult);
search = searchIn;
adapter.reFilter();
+ adapter.notifyDataSetChanged();
updateTitle();
showFooterMoreCaches();
}
diff --git a/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java b/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java
index 6cafd96..eb96fa6 100644
--- a/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java
+++ b/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java
@@ -43,13 +43,20 @@ public abstract class AbstractSearchLoader extends AsyncTaskLoader<SearchResult>
@Override
public SearchResult loadInBackground() {
loading = true;
- if (search == null) {
- search = runSearch();
- } else {
- // Unless we make a new Search the Loader framework won't deliver results. It does't do equals only identity
- search = GCParser.searchByNextPage(new SearchResult(search), Settings.isShowCaptcha(), this);
+ try {
+ if (search == null) {
+ search = runSearch();
+ } else {
+ // Unless we make a new Search the Loader framework won't deliver results. It does't do equals only identity
+ search = GCParser.searchByNextPage(new SearchResult(search), Settings.isShowCaptcha(), this);
+ }
+ } catch (Exception e) {
+ Log.e("Error in Loader ", e);
}
loading = false;
+ if (search == null) {
+ search = new SearchResult();
+ }
return search;
}