[Android] Always check media Uri when launch from 3rd party

Geoffrey Métais git at videolan.org
Mon Mar 21 12:10:57 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar 21 12:10:09 2016 +0100| [4d906d739d959976139e9c18e93f8beb42602221] | committer: Geoffrey Métais

Always check media Uri when launch from 3rd party

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

 vlc-android/src/org/videolan/vlc/StartActivity.java | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.java b/vlc-android/src/org/videolan/vlc/StartActivity.java
index 532af14..a23da29 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.java
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.java
@@ -57,11 +57,11 @@ public class StartActivity extends Activity {
         super.onCreate(savedInstanceState);
         Intent intent = getIntent();
         if (intent != null && TextUtils.equals(intent.getAction(), Intent.ACTION_VIEW) && intent.getData() != null) {
+            intent.setData(getUri(intent));
             if (intent.getType() != null && intent.getType().startsWith("video")) {
                 intent.setClass(this, VideoPlayerActivity.class);
                 startActivity(intent);
             } else {
-                intent.setData(getUri(intent));
                 MediaUtils.openUri(this, intent.getData());
             }
         } else if (intent != null && TextUtils.equals(intent.getAction(), AudioPlayerContainerActivity.ACTION_SHOW_PLAYER)) {
@@ -116,11 +116,8 @@ public class StartActivity extends Activity {
                         if (cursor.moveToFirst())
                             mUri = AndroidUtil.PathToUri(cursor.getString(column_index));
                         cursor.close();
-                    }
-                    // other content-based URI (probably file pickers)
-                    else {
+                    } else // other content-based URI (probably file pickers)
                         mUri = data;
-                    }
                 } catch (Exception e) {
                     mUri = data;
                     if (mUri.getScheme() == null)



More information about the Android mailing list