[Android] VideoPlayerActivity: Prevent ClassCastException

Geoffrey Métais git at videolan.org
Fri Mar 30 16:51:19 CEST 2018


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

VideoPlayerActivity: Prevent ClassCastException

On Android 4.0.x

(cherry picked from commit e943418ca5d368d7b20b9b554aa05348758cac19)

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

 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