[Android] VideoPlayerActivity: Prevent ClassCastException

Geoffrey Métais git at videolan.org
Thu Mar 22 11:44:51 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Mar 22 10:26:29 2018 +0100| [e943418ca5d368d7b20b9b554aa05348758cac19] | committer: Geoffrey Métais

VideoPlayerActivity: Prevent ClassCastException

On Android 4.0.x

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 9cdfc97af..1b5765388 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -385,8 +385,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
         mTitle = mActionBarView.findViewById(R.id.player_overlay_title);
         if (!AndroidUtil.isJellyBeanOrLater) {
-            mSysTime = (TextView) findViewById(R.id.player_overlay_systime);
-            mBattery = (TextView) findViewById(R.id.player_overlay_battery);
+            View v = findViewById(R.id.player_overlay_systime);
+            if (v instanceof TextView) mSysTime = (TextView) v;
+            v = findViewById(R.id.player_overlay_battery);
+            if (v instanceof TextView) mBattery = (TextView) v;
         }
 
         mPlaylistToggle = (ImageView) findViewById(R.id.playlist_toggle);



More information about the Android mailing list