package neko;

import android.util.Log;
import clojure.java.api.Clojure;
import clojure.lang.DalvikDynamicClassLoader;
import clojure.lang.Var;
import clojure.lang.IFn;

public class App extends android.app.Application {

    private static String TAG = "neko.App";
    public static App instance;

    @Override
    public void onCreate() {
        instance = this;
        DalvikDynamicClassLoader.setContext(this);
    }

    // This method is only necessary for asynchronous loading. Clojure is
    // perfectly capable of loading itself the first time anything from it is
    // called.
    public static void loadClojure() {
        IFn require = Clojure.var("clojure.core", "require");
        require.invoke(Clojure.read("neko.tools.repl"));

        IFn init = Clojure.var("neko.tools.repl", "init");
        init.invoke();
    }

    public static void loadAsynchronously(final String activityClass, final Runnable callback) {
        new Thread(Thread.currentThread().getThreadGroup(),
                   new Runnable(){
                       @Override
                       public void run() {
                           loadClojure();

                           try {
                               Class.forName(activityClass);
                           } catch (ClassNotFoundException e) {
                               Log.e(TAG, "Failed loading activity " + activityClass, e);
                           }

                           callback.run();
                       }
                   },
                   "ClojureLoadingThread",
                   1048576 // = 1MB, thread stack size in bytes
                   ).start();
    }

}

@@ -8,16 +8,48 @@
  neko;%0A%0A
+import android.app.Application;%0A
 import a
@@ -220,28 +220,16 @@
 extends 
-android.app.
 Applicat
@@ -300,16 +300,24 @@
 atic App
+lication
  instanc

Allow regular Application in instance