From 430706802214d101cfbe79591ee3dccd8b45a6eb Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Sun, 26 Jan 2014 04:45:48 -0500 Subject: [PATCH] Stop hanging out in the background, this toast is important --- shell/android/src/com/reicast/emulator/MOGAInput.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/shell/android/src/com/reicast/emulator/MOGAInput.java b/shell/android/src/com/reicast/emulator/MOGAInput.java index e9ee451f8..1bf7edf05 100644 --- a/shell/android/src/com/reicast/emulator/MOGAInput.java +++ b/shell/android/src/com/reicast/emulator/MOGAInput.java @@ -32,6 +32,8 @@ public class MOGAInput static final int ACTION_VERSION_MOGAPRO = Controller.ACTION_VERSION_MOGAPRO; Controller mController = null; + private Handler handler; + private String notify; public boolean isActive[] = { false, false, false, false }; public boolean isMogaPro[] = { false, false, false, false }; @@ -98,6 +100,8 @@ public class MOGAInput protected void onCreate(Activity act) { this.act = act; + + handler = new Handler(); mController = Controller.getInstance(act); mController.init(); @@ -231,7 +235,6 @@ public class MOGAInput if (event.getState() == StateEvent.STATE_CONNECTION && event.getAction() == ACTION_CONNECTED) { int mControllerVersion = mController.getState(Controller.STATE_CURRENT_PRODUCT_VERSION); - String notify = null; if (mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) { isActive[playerNum] = true; isMogaPro[playerNum] = true; @@ -244,7 +247,11 @@ public class MOGAInput notify = act.getApplicationContext().getString(R.string.moga_connect); } if (notify != null && !notify.equals(null)) { - Toast.makeText(act.getApplicationContext(), notify, Toast.LENGTH_SHORT).show(); + handler.post(new Runnable() { + public void run() { + Toast.makeText(act.getApplicationContext(), notify, Toast.LENGTH_SHORT).show(); + } + }); } } }