[Android] Set settings sooner to prevent crash

Geoffrey Métais git at videolan.org
Tue May 23 16:55:18 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 23 16:54:32 2017 +0200| [994225fc9303a0da77db0244401f5a56a77eda61] | committer: Geoffrey Métais

Set settings sooner to prevent crash

> https://code.videolan.org/videolan/vlc-android/commit/994225fc9303a0da77db0244401f5a56a77eda61
---

 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index 5fb3ecd34..774caf41e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -110,6 +110,12 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
     private static final String PREF_AUDIOPLAYER_TIPS_SHOWN = "audioplayer_tips_shown";
 
     @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mSettings = PreferenceManager.getDefaultSharedPreferences(getActivity());
+    }
+
+    @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         mBinding = AudioPlayerBinding.inflate(inflater);
         return mBinding.getRoot();
@@ -152,7 +158,6 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
             coverConstraintSet.setVisibility(R.id.songs_list, View.GONE);
             coverConstraintSet.setVisibility(R.id.cover_media_switcher, View.VISIBLE);
         }
-        mSettings = PreferenceManager.getDefaultSharedPreferences(getActivity());
     }
 
     @Override



More information about the Android mailing list