Android

From J Wiki
Jump to navigation Jump to search

Also see this exciting news about J on iPhone/iPad (iOS)!


General Approach

The following are lightly-edited comments from Michael Dykman when I asked him about getting involved in the J on Android project.

Version of Android

To the present implementation: I am targeting Android 2.1 and up. I chose this level as I have it on good advice that the app will run on 94% of the devices in the market. Had I selected 2.3, I would have had the option of a pure 'C' environment, but limited the audience losing up to 40% of potential users. As it is, the Android interface is purely in Java using JNI to interface to the J engine with a thin layer of 'C' to mediate.

Some Goals

I have several long-term goals for this Android package.

1. interactive text console w/ editors modeled on J6's jwd, sadly, without the wd in v1. 1. The J engine running as a service so that Android developers (users of Java mostly but some C/C++) can use embedded J within their accustomed environment, moving all the UI responsibilities away from J. 1. A set of j-widgets designed for rapid mobile app development on top of this package-as-a-platform For the first item, I have a working model with a few things to address before I share too widely. The second goal I think is just a matter of 10 or 20 hours of Java, not likely to happen before I have 1) in a sane, releasable state. The third, I can think of more than one approach, all of them involving a lot of work.

I had the pleasure of meeting Eric Iverson for the first time last week and having dinner with him which was the first close-in feedback I have had (I don't know any other J'ers in the flesh). He added another target which I had largely been ignoring: embedded JHS. He was able to show me that my graphics-free implementation was already able to produce viewmat images and expressed optimism that enabling plot should be a small exercise.

The implementation of plot was accomplished by Bill Lam who modified the plot.ijs script to generate PDF file (as ~temp/plot.pdf) and subsequently launching an external PDF viewer (assuming one has previously been installed in the device. He also implemented viewmat using a similar strategy, using bitmap as the underlaying format..

Tools for Working with Android

The tool "git" will be necessary for accessing the central codebase. The sum of the work is published across 2 github repositories. One is a fork of Jeff Zellner's jcore repository, forked so that I can freely ply my changes willing allowing for upstream merges, that other contains the android-only components.

The repositories need to be overlayed to satisfy android-project conventions allowing their tool-set to work. First checkout j_console_for_android, which will create a directory named 'jni/'. The J engine, core, should be checked out into a sub-directory of 'jni/'.

Following github convention (which I find very sensible) If you plan on a read-only build (go ahead and modify but never share changes back), you should check out the repositories directly. If you intend to make any changes to share, log in to git hub, browse to the project page and 'fork' those projects. This will provide you with a unique git url which you can then check out and treat as your own. When you want to share changes upstream, issue a pull request.

The toolset is non-trivial but available for the big 3 desktops. I am working on a redhat system, myself.

Also, get Eclipse, the latest version. If unsure, get Eclipse for Java developers (NOT J2EE) Android Developer Toolkit (as an Eclipse addon, requires post-install updating) AVD - Android Virtual Device tool, provides android emulators (optionally embedded in Eclipse) NDK - command line tools/cross-compilers for building native C accessible via JNI (java->C bridge)

Keyboard

A keyboard which is more friendly to J has been bundled as part of the application package. The layout for the symbol and numeric keyboards were based on suggestions by Chris Burke.