Corona Enterprise access main thread

Hi everyone,

I am using corona enterprise with native android code, i need access of main thread. How can i achieve it?

Thanks in advance

Have a look at Corona Enterprise sample project “SimpleLuaExtension”.  Particularly its “AsyncCallLuaFunction.java” file.  That example shows you how to use a Java “Runnable” class to invoke something on the main UI thread from the Corona thread.  It also shows you how to get back on to the Corona thread from the main UI thread (or any thread really) via our “CoronaRuntimeTaskDispatcher” class.  The Java code in that example is heavily commented/documented and I think it does a good job explaining how it works.

 

Here are some Java class/method documentation that will help you out as well…

   http://developer.android.com/reference/java/lang/Runnable.html

   http://developer.android.com/reference/android/app/Activity.html#runOnUiThread(java.lang.Runnable)

   http://docs.coronalabs.com/daily/native/android/html/com/ansca/corona/package-summary.html

 

Our Corona Enterprise bundle also includes an “ExtendingUI” sample project which shows you how to add native Android UI on top of our CoronaView.  It’s worth a look as well, but it doesn’t show you how to pass a Lua function to Java and have it called later… provided that’s something you need to do.

Have a look at Corona Enterprise sample project “SimpleLuaExtension”.  Particularly its “AsyncCallLuaFunction.java” file.  That example shows you how to use a Java “Runnable” class to invoke something on the main UI thread from the Corona thread.  It also shows you how to get back on to the Corona thread from the main UI thread (or any thread really) via our “CoronaRuntimeTaskDispatcher” class.  The Java code in that example is heavily commented/documented and I think it does a good job explaining how it works.

 

Here are some Java class/method documentation that will help you out as well…

   http://developer.android.com/reference/java/lang/Runnable.html

   http://developer.android.com/reference/android/app/Activity.html#runOnUiThread(java.lang.Runnable)

   http://docs.coronalabs.com/daily/native/android/html/com/ansca/corona/package-summary.html

 

Our Corona Enterprise bundle also includes an “ExtendingUI” sample project which shows you how to add native Android UI on top of our CoronaView.  It’s worth a look as well, but it doesn’t show you how to pass a Lua function to Java and have it called later… provided that’s something you need to do.