Revision: 2295
http://sourceforge.net/p/swingme/code/2295
Author: yuranet
Date: 2013-10-30 22:04:20 +0000 (Wed, 30 Oct 2013)
Log Message:
-----------
added hook for post start app
Modified Paths:
--------------
AndroidME/src_Android/net/yura/android/AndroidMeActivity.java
AndroidME/src_Android/net/yura/android/AndroidMeApp.java
Modified: AndroidME/src_Android/net/yura/android/AndroidMeActivity.java
===================================================================
--- AndroidME/src_Android/net/yura/android/AndroidMeActivity.java 2013-10-29 23:13:15 UTC (rev 2294)
+++ AndroidME/src_Android/net/yura/android/AndroidMeActivity.java 2013-10-30 22:04:20 UTC (rev 2295)
@@ -64,7 +64,7 @@
new Thread() {
public void run() {
// waitForDefaultView(); TODO:!!!!
- AndroidMeApp.startMIDlet();
+ startMIDlet();
}
}.start();
}
@@ -90,6 +90,30 @@
// System.setOut(log);
}
+ public void startMIDlet() {
+ // Needs to run on the UI thread, otherwise some of the API's will not start
+ AndroidMeApp.getIntance().invokeLater(new Runnable() {
+ public void run() {
+ try {
+ MIDlet midlet = AndroidMeApp.getMIDlet();
+ Display display = Display.getDisplay(midlet);
+ if (display.hiddenDisplay!=null) {
+ display.setCurrent(display.hiddenDisplay);
+ }
+ midlet.doStartApp();
+ onMidletStarted();
+ }
+ catch (Exception ex) {
+ throw new RuntimeException("unable to start MIDlet: ", ex);
+ }
+ }
+ });
+ }
+
+ public void onMidletStarted() {
+ // hook for doing something after the midlet has been started
+ }
+
private boolean foreground;
@Override
protected void onResume() {
@@ -225,7 +249,7 @@
waitForDefaultView();
AndroidMeApp.createMIDlet(midletClassName);
- AndroidMeApp.startMIDlet();
+ startMIDlet();
} catch (Throwable ex) {
Logger.warn(ex);
}
Modified: AndroidME/src_Android/net/yura/android/AndroidMeApp.java
===================================================================
--- AndroidME/src_Android/net/yura/android/AndroidMeApp.java 2013-10-29 23:13:15 UTC (rev 2294)
+++ AndroidME/src_Android/net/yura/android/AndroidMeApp.java 2013-10-30 22:04:20 UTC (rev 2295)
@@ -67,29 +67,6 @@
instance.invokeAndWait(new Thread());
}
- // TODO: Async
- public static void startMIDlet() {
- // Needs to run on the UI thread, otherwise some of the API's will not start
- instance.handler.post(new Runnable() {
- public void run() {
- try {
-
- Display display = Display.getDisplay(instance.midlet);
-
- if (display.hiddenDisplay!=null) {
- display.setCurrent(display.hiddenDisplay);
- }
-
- instance.midlet.doStartApp();
-
-
- } catch (Exception ex) {
- throw new RuntimeException("unable to start MIDlet: ", ex);
- }
- }
- });
- }
-
public static Vector<String[]> getJadMidlets() {
return instance.jadMidlets;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|