offline: workaround against crashes in fragment refreshes
This commit is contained in:
parent
caef01010f
commit
124c791ab8
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.fox.ttrss"
|
||||
android:versionCode="183"
|
||||
android:versionName="1.8.3" >
|
||||
android:versionCode="184"
|
||||
android:versionName="1.8.4" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
|
@ -121,13 +121,19 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close();
|
||||
try {
|
||||
if (!isAdded()) return;
|
||||
|
||||
m_cursor = createCursor();
|
||||
if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close();
|
||||
|
||||
if (m_cursor != null) {
|
||||
m_adapter.changeCursor(m_cursor);
|
||||
m_adapter.notifyDataSetChanged();
|
||||
m_cursor = createCursor();
|
||||
|
||||
if (m_cursor != null && m_adapter != null) {
|
||||
m_adapter.changeCursor(m_cursor);
|
||||
m_adapter.notifyDataSetChanged();
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,13 +256,19 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close();
|
||||
try {
|
||||
if (!isAdded()) return;
|
||||
|
||||
m_cursor = createCursor();
|
||||
if (m_cursor != null && !m_cursor.isClosed()) m_cursor.close();
|
||||
|
||||
if (m_cursor != null) {
|
||||
m_adapter.changeCursor(m_cursor);
|
||||
m_adapter.notifyDataSetChanged();
|
||||
m_cursor = createCursor();
|
||||
|
||||
if (m_cursor != null && m_adapter != null) {
|
||||
m_adapter.changeCursor(m_cursor);
|
||||
m_adapter.notifyDataSetChanged();
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user