I was able to successfully embed a picoLisp web app into a java
Android app. It's just a form that outputs what's in the textbox. I've
also been able to prove that database access calls work but I haven't
integrated it into this example.

I also recorded a terrible video of it :).
https://picasaweb.google.com/lh/photo/FLO3jIBS99dNPOeb9gC78s8zJy1Iv3Dkn7PZ5E-PSQc?feat=directlink.
I ran out of time to redo. I've added a sleep to help ensure that
picoLisp is running before the web page is rendered:


I've tried it on both my android (DroidX) phone and my kindle fire.

The core java code is quite simple. The toasts don't appear for some
reason while it's downloading the required files but it does appear
when it's starting.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    // ToDo add your GUI initialization code here
    setContentView(R.layout.main);

    Context context = getApplicationContext();

    String localPath = "/data/data/org.me.androiddemo/";
    String local = localPath + "arm-picoLisp.tar.gz";

    if (!new File(localPath + "busybox").exists()) {
      Toast.makeText(context, "Downloading busybox", Toast.LENGTH_SHORT).show();
      download("http://dl.dropbox.com/u/20783971/busybox";, localPath +
"busybox");
      exec("/system/bin/chmod 744 " + localPath + "busybox");
    }

    if (!new File(local).exists()) {
      Toast.makeText(context, "Downloading picoLisp",
Toast.LENGTH_SHORT).show();
      download("http://dl.dropbox.com/u/20783971/arm-picoLisp.tar.gz";, local);
      exec(localPath + "busybox tar -zxvf " + local + " -C " + localPath);
    }

    exec(localPath + "busybox killall -9 picolisp");



    Toast.makeText(context, "Starting App", Toast.LENGTH_SHORT).show();

    execAsync(localPath + "arm-picoLisp/pil @lib/http.l @lib/xhtml.l "
+ localPath + "arm-picoLisp/s.l", localPath + "arm-picoLisp");

    try {
        Thread.sleep(1000);
    }  catch (InterruptedException e) {
    }
    WebView mWebView;

    mWebView = (WebView) findViewById(R.id.webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.setWebViewClient(new WebViewClient() {
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url) {

        view.loadUrl(url);

        return true;

      }
    });
    mWebView.loadUrl("http://127.0.0.1:8001/";);
}

Attachment: demo_android_signed.apk
Description: application/vnd.android.package-archive

Attachment: MainActivity.java
Description: Binary data

Reply via email to