[Android] All subclasses of Fragment must include a public empty constructor.

Ludovic Fauvet git at videolan.org
Sun Sep 30 15:11:37 CEST 2012


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Sun Sep 30 15:09:17 2012 +0200| [bdf849251a2e2b91a4ba9b3dab960f6ae8a2e7b8] | committer: Ludovic Fauvet

All subclasses of Fragment must include a public empty constructor.

"The framework will often re-instantiate a fragment class when needed,
in particular during state restore, and needs to be able to find this
constructor to instantiate it. If the empty constructor is not
available, a runtime exception will occur in some cases during state
restore."

https://developer.android.com/reference/android/app/Fragment.html

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=bdf849251a2e2b91a4ba9b3dab960f6ae8a2e7b8
---

 vlc-android/src/org/videolan/vlc/gui/AboutLicenceFragment.java      |    3 +++
 vlc-android/src/org/videolan/vlc/gui/AboutMainFragment.java         |    3 +++
 vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java     |    3 +++
 vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java           |    3 +++
 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java        |    3 +++
 vlc-android/src/org/videolan/vlc/gui/audio/AudioListFragment.java   |    3 +++
 vlc-android/src/org/videolan/vlc/gui/video/VideoListFragment.java   |    3 +++
 7 files changed, 21 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutLicenceFragment.java b/vlc-android/src/org/videolan/vlc/gui/AboutLicenceFragment.java
index 95c5156..7021ca6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutLicenceFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutLicenceFragment.java
@@ -33,6 +33,9 @@ import android.webkit.WebView;
 public class AboutLicenceFragment extends Fragment {
     public final static String TAG = "VLC/AboutLicenceFragment";
 
+    /* All subclasses of Fragment must include a public empty constructor. */
+    public AboutLicenceFragment() { }
+
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
     {
diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutMainFragment.java b/vlc-android/src/org/videolan/vlc/gui/AboutMainFragment.java
index dedd860..58f6449 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutMainFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutMainFragment.java
@@ -40,6 +40,9 @@ import android.widget.TextView;
 public class AboutMainFragment extends Fragment {
     public final static String TAG = "VLC/AboutMainFragment";
 
+    /* All subclasses of Fragment must include a public empty constructor. */
+    public AboutMainFragment() { }
+
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
     {
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index d6d2adf..55a15ae 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -53,6 +53,9 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
 
     private DirectoryAdapter mDirectoryAdapter;
 
+    /* All subclasses of Fragment must include a public empty constructor. */
+    public DirectoryViewFragment() { }
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
index 8232d69..b47dda6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
@@ -38,6 +38,9 @@ public class HistoryFragment extends SherlockListFragment {
 
     private HistoryAdapter mHistoryAdapter;
 
+    /* All subclasses of Fragment must include a public empty constructor. */
+    public HistoryFragment() { }
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 3eb80af..8231715 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -90,6 +90,9 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
     public final static int MODE_SONG = 2;
     public final static int MODE_GENRE = 3;
 
+    /* All subclasses of Fragment must include a public empty constructor. */
+    public AudioBrowserFragment() { }
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioListFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioListFragment.java
index 82c7b44..3235a4f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioListFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioListFragment.java
@@ -69,6 +69,9 @@ public class AudioListFragment extends SherlockListFragment {
     public final static String EXTRA_NAME2 = "name2";
     public final static String EXTRA_MODE = "mode";
 
+    /* All subclasses of Fragment must include a public empty constructor. */
+    public AudioListFragment() { }
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListFragment.java
index 17afa7c..99f8289 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListFragment.java
@@ -81,6 +81,9 @@ public class VideoListFragment extends SherlockListFragment implements ISortable
     private MediaLibrary mMediaLibrary;
     private ThumbnailerManager mThumbnailerManager;
 
+    /* All subclasses of Fragment must include a public empty constructor. */
+    public VideoListFragment() { }
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);



More information about the Android mailing list