[Android] Prevent NPE on setUserVisibleHint
Geoffrey Métais
git at videolan.org
Mon May 4 13:55:49 CEST 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 4 13:53:47 2015 +0200| [43e612df6c0fc87d14e3ce738f129f6ed8e2fbcc] | committer: Geoffrey Métais
Prevent NPE on setUserVisibleHint
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=43e612df6c0fc87d14e3ce738f129f6ed8e2fbcc
---
vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java | 9 +++++++++
1 file changed, 9 insertions(+)
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 64beb5b..3e08e29 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -713,4 +713,13 @@ public class AudioPlayer extends Fragment implements IAudioPlayer, View.OnClickL
if(activity != null)
activity.showTipViewIfNeeded(R.layout.audio_player_tips, PREF_AUDIOPLAYER_TIPS_SHOWN);
}
+
+ /*
+ * Override this method to prefent NPE on mFragmentManager reference.
+ */
+ @Override
+ public void setUserVisibleHint(boolean isVisibleToUser) {
+ if (getFragmentManager() != null)
+ super.setUserVisibleHint(isVisibleToUser);
+ }
}
More information about the Android
mailing list