[Android] MediaBrowserFragment: fix actionbar compat

Geoffrey Métais geoffrey.metais at gmail.com
Wed Jul 1 17:32:38 CEST 2015


You coul replace the  getActivity().supportInvalidateOptionsMenu();
with activity too

On Wed, Jul 1, 2015 at 3:14 PM Thomas Guillem <git at videolan.org> wrote:

> 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();
>          }
>      }
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20150701/d983a9ec/attachment.html>


More information about the Android mailing list