[Android] MediaBrowserFragment: fix actionbar compat

Thomas Guillem git at videolan.org
Wed Jul 1 15:14:34 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul  1 10:41:59 2015 +0200| [0fbf6cd161f2a95b4fc795e39bfc972306c90851] | committer: Thomas Guillem

MediaBrowserFragment: fix actionbar compat

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

 .../src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java    |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
index 73657b7..484727a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
@@ -45,8 +45,9 @@ public abstract class MediaBrowserFragment extends PlaybackServiceFragment {
     public abstract void clear();
     public void onStart(){
         super.onStart();
-        if (getActivity().getActionBar() != null) {
-            ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(getTitle());
+        final AppCompatActivity activity = (AppCompatActivity)getActivity();
+        if (activity != null && activity.getSupportActionBar() != null) {
+            activity.getSupportActionBar().setTitle(getTitle());
             getActivity().supportInvalidateOptionsMenu();
         }
     }



More information about the Android mailing list