From: moly <0700689@live.abertay.ac.uk> Date: Wed, 10 Oct 2012 15:24:48 +0000 (+0100) Subject: openURI in android backend now uses runOnUIThread X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4b92bfa0532125780de8d2712ab0ac7a20eebae1;p=mikumikustudio%2Flibgdx-mikumikustudio.git openURI in android backend now uses runOnUIThread --- diff --git a/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidApplication.java b/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidApplication.java index b3b55e05b..58826e76b 100644 --- a/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidApplication.java +++ b/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidApplication.java @@ -173,6 +173,7 @@ public class AndroidApplication extends Activity implements Application { input = new AndroidInput(this, graphics.view, config); audio = new AndroidAudio(this, config); files = new AndroidFiles(this.getAssets(), this.getFilesDir().getAbsolutePath()); + net = new AndroidNet(this); this.listener = listener; this.handler = new Handler(); @@ -181,6 +182,7 @@ public class AndroidApplication extends Activity implements Application { Gdx.audio = this.getAudio(); Gdx.files = this.getFiles(); Gdx.graphics = this.getGraphics(); + Gdx.net = this.getNet(); createWakeLock(config); return graphics.getView(); @@ -221,6 +223,7 @@ public class AndroidApplication extends Activity implements Application { Gdx.audio = this.getAudio(); Gdx.files = this.getFiles(); Gdx.graphics = this.getGraphics(); + Gdx.net = this.getNet(); ((AndroidInput)getInput()).registerSensorListeners(); diff --git a/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidNet.java b/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidNet.java index 4215741dc..2d25844f3 100755 --- a/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidNet.java +++ b/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidNet.java @@ -17,6 +17,7 @@ package com.badlogic.gdx.backends.android; import android.content.Intent; +import android.net.Uri; import com.badlogic.gdx.Net; import com.badlogic.gdx.Net.HttpResult; @@ -58,6 +59,12 @@ public class AndroidNet implements Net { @Override public void openURI(String URI) { - app.startActivity(new Intent(Intent.ACTION_VIEW, android.net.Uri.parse(URI))); + final Uri uri = Uri.parse(URI); + app.runOnUiThread(new Runnable(){ + @Override + public void run () { + app.startActivity(new Intent(Intent.ACTION_VIEW, uri)); + } + }); } }