[Android] URLDecoder.decode(string) is deprecated, use the encode(String, String) instead

Sébastien Toque git at videolan.org
Fri Jun 22 07:04:57 CEST 2012


android | branch: master | Sébastien Toque <xilasz at gmail.com> | Fri Jun 22 06:59:25 2012 +0200| [cd769ec163f4e9f41486fc4dec098938a483fbb1] | committer: Sébastien Toque

URLDecoder.decode(string) is deprecated, use the encode(String,String) instead

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=cd769ec163f4e9f41486fc4dec098938a483fbb1
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java      |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 d2704d6..e32cad2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -21,6 +21,7 @@
 package org.videolan.vlc.gui.video;
 
 import java.io.File;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Method;
 import java.net.URLDecoder;
 
@@ -849,7 +850,10 @@ public class VideoPlayerActivity extends Activity {
             if (lastTime > 0 && location.equals(lastLocation))
                 mLibVLC.setTime(lastTime);
 
-            title = URLDecoder.decode(location);
+            try {
+                title = URLDecoder.decode(location, "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+            }
             if (title.startsWith("file:")) {
                 title = new File(title).getName();
                 int dotIndex = title.lastIndexOf('.');



More information about the Android mailing list