Commit 01de6941 authored by Sébastien Toque's avatar Sébastien Toque
Browse files

respect fragment's lifecycle

this should fix this error :
java.lang.RuntimeException: Unable to destroy activity
...
Caused by: java.lang.IllegalArgumentException: Receiver not registered:
parent 68a2bbde
......@@ -111,7 +111,7 @@ public class VideoListFragment extends SherlockListFragment implements ISortable
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
registerForContextMenu(getListView());
// init the information for the scan (2/2)
IntentFilter filter = new IntentFilter();
filter.addAction(ACTION_SCAN_START);
......@@ -120,7 +120,6 @@ public class VideoListFragment extends SherlockListFragment implements ISortable
Log.i(TAG,"mMediaLibrary.ismLoadingThreadrunning() " + Boolean.toString(mMediaLibrary.ismLoadingThreadrunning()));
if (mMediaLibrary.ismLoadingThreadrunning()) {
actionScanStart(getActivity().getApplicationContext());
}
updateList();
......@@ -149,11 +148,16 @@ public class VideoListFragment extends SherlockListFragment implements ISortable
super.onResume();
}
@Override
public void onDestroyView() {
getActivity().unregisterReceiver(messageReceiverVideoListFragment);
super.onDestroyView();
}
@Override
public void onDestroy() {
mBarrier.reset();
mVideoAdapter.clear();
getActivity().unregisterReceiver(messageReceiverVideoListFragment);
super.onDestroy();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment