[Android] Fix lollipop webview crash

Nicolas Pomepuy git at videolan.org
Fri Feb 28 11:28:10 CET 2020


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Feb 28 11:10:48 2020 +0100| [977f5f830b9d8e8458d5215d0c0258a3bb3ff1a0] | committer: Geoffrey Métais

Fix lollipop webview crash

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

 vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt
index 1824cc060..4608c1215 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt
@@ -24,6 +24,8 @@
 package org.videolan.vlc.gui
 
 import android.content.Intent
+import android.content.res.AssetManager
+import android.os.Build
 import android.os.Bundle
 import android.os.Parcelable
 import android.view.MenuItem
@@ -92,6 +94,12 @@ class SecondaryActivity : ContentActivity() {
                 .commit()
     }
 
+    //workaround for Error inflating class android.webkit.WebView
+    override fun getAssets(): AssetManager {
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1 && intent.getStringExtra(KEY_FRAGMENT) == ABOUT) return resources.assets
+        return super.getAssets()
+    }
+
     override fun onResume() {
         overridePendingTransition(0, 0)
         super.onResume()



More information about the Android mailing list