diff options
| author | Juan Linietsky | 2014-12-15 15:42:58 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2014-12-15 15:42:58 -0300 |
| commit | 089d7fa171e3a3305991047e82b4043d4f05783f (patch) | |
| tree | a41af5ab93f6d745962e471da8dc6003e6b8e430 /platform/android/java/src | |
| parent | be4e40e90a5a322f6a7cec4893854ef5b15db600 (diff) | |
| download | godot-089d7fa171e3a3305991047e82b4043d4f05783f.tar.gz godot-089d7fa171e3a3305991047e82b4043d4f05783f.tar.zst godot-089d7fa171e3a3305991047e82b4043d4f05783f.zip | |
Diffstat (limited to 'platform/android/java/src')
| -rw-r--r-- | platform/android/java/src/com/android/godot/GodotIO.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/platform/android/java/src/com/android/godot/GodotIO.java b/platform/android/java/src/com/android/godot/GodotIO.java index d14991689..ff0eb5edc 100644 --- a/platform/android/java/src/com/android/godot/GodotIO.java +++ b/platform/android/java/src/com/android/godot/GodotIO.java @@ -438,8 +438,26 @@ public class GodotIO { try { Log.v("MyApp", "TRYING TO OPEN URI: " + p_uri); - Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(p_uri)); - activity.startActivity(myIntent); + String path = p_uri; + String type=""; + if (path.startsWith("/")) { + //absolute path to filesystem, prepend file:// + path="file://"+path; + if (p_uri.endsWith(".png") || p_uri.endsWith(".jpg") || p_uri.endsWith(".gif") || p_uri.endsWith(".webp")) { + + type="image/*"; + } + } + + Intent intent = new Intent(); + intent.setAction(Intent.ACTION_VIEW); + if (!type.equals("")) { + intent.setDataAndType(Uri.parse(path), type); + } else { + intent.setData(Uri.parse(path)); + } + + activity.startActivity(intent); return 0; } catch (ActivityNotFoundException e) { |
