From: Paul P. <bay...@gm...> - 2011-03-23 23:59:15
|
Yep, I try to avoid reflection at all costs. I had made a similar class so that there's only one place where reflection occurs. So instead of performSelector..., I call performRunnable... package blah.blah.blah; import org.xmlvm.iphone.NSObject; import blah.blah.Logger; public class IPhoneUtil { private static final Logger log = new Logger(IPhoneUtil.class); private static IPhoneUtil utilInstance = new IPhoneUtil(); private IPhoneUtil() { } public static void performRunnableOnMainThread(Runnable runnable, booleanwaitUntilDone) { NSObject.performSelectorOnMainThread(utilInstance, "executeRunnable", runnable, waitUntilDone); } /** * Execute a runnable on the main thread. This is only called via reflection * using performSelectorOnMainThread * @param arg the Runnable object */ public void executeRunnable(Object arg) { if (arg instanceof Runnable) { Runnable r = (Runnable)arg; r.run(); } else { log.info("Could not execute Runnable. Unexpected parameter type: " + (arg == null ? null : arg.getClass().getName())); } } } On Wed, Mar 23, 2011 at 4:42 PM, Arno Puder <ar...@pu...> wrote: > > > On 3/23/2011 2:40 PM, Panayotis Katsaloulis wrote: > > Right now the patch is half-ready. > > It is only a presentation of the API I propose (alongside the necessary > changes for Android to be compatible). > > There are not even bindings for the ObjC backend, so it still needs a lot > of work. > > > > I just wanted to be sure that you agree with this change before spend > more time with it. > > your patch is definitely going in the right direction. Time to get your > hands dirty with the C backend! :) > > Arno > > |