From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,5059e1c3870d4dc8 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Ada on Android? References: <82zkiihpjo.fsf@stephe-leake.org> <657d70d1-2df5-4436-a44c-c97228daff27@l4g2000vbv.googlegroups.com> <82pqjeh3mq.fsf@stephe-leake.org> Date: Wed, 07 Sep 2011 20:15:12 -0400 Message-ID: <82fwk7khyn.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (windows-nt) Cancel-Lock: sha1:TeESj0Y5juS850OWPh/kwD0Yt4k= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: dda4c4e6808fee029e66132324 Xref: g2news2.google.com comp.lang.ada:21845 Date: 2011-09-07T20:15:12-04:00 List-Id: Brian Drummond writes: > On Mon, 05 Sep 2011 21:16:13 -0400, Stephen Leake wrote: > >> onox writes: >> >>> On Sep 5, 7:22 pm, Stephen Leake >>> wrote: >>>> Has anyone here done any Ada for Android? >>>> >>>> >>> You might be interested in checking the GNATDroid (Android 2.3+) cross- >>> compiler for FreeBSD at http://www.dragonlace.net/ >> >> I don't need to target ARM; the Android API is for the JVM target. > > Was. > > As of Android 2.3, the API has also been opened up to native (usually > ARM) code. See > http://developer.android.com/sdk/ndk/index.html > > There was some support for C on earlier Android versions but as of 2.3 > it's supposed to be complete and for C++ too. Performance aside, this may > be a better approach than targetting the JVM. For example, is it possible > the Ada compiler hits some difference between JVM and Dalvik that isn't > important to the Java compiler? I never got as far as actually trying to run things. I'm writing a music player app, that uses lots of neat stuff (like a low level music player) in the Android API. So I need to use the JVM. The compiler bugs are encountered when trying to compile the specs of the Ada binding to the API, not in the code generator. > This (in 2.3) was apparently intended as a sop to the C++ community >but > opens the way to Ada as well via the Dragonlace compiler (or my so far > unsuccessful attempts at building FSF Gnat 4.6/4.7 to target Arm on > Linux). Ada is supposed to be able to target the JVM; also being able to target ARM is an orthogonal issue. Targeting the ARM would be useful for compiling a new cryptographic library, for example. Totally unnecessary for building a music player. >> The problem is binding to the Android API; I don't see any mention of >> that on the DragonLace.Net page. > > The NDK documentation will cover that (for C++ anyway); as far as I can > see, it's a mess. You may not ever need Java but you will need the SDK's > GUI builder (and from the SDK examples, that still requires hand editing > XML!) I already have a working app written in Java; I found the Java source code for the example music player written by Google, and adapted it. Not hard, and I found the on-line Android API docs to be adequate, if not outstanding. But I still want to redo it in Ada before I add more features. I'm don't understand what "SDK GUI Builder" you are talking about; I used Eclipse and the Android toolkit, as the Hello World tutorial says. And yes, the GUI builder suffers from the same WYSIAYG problems every other GUI builder I've used has; editing XML was necessary, but also far easier than trying to do the same thing in the GUI builder. It is possible to do without the GUI builder by writing either Java or Ada code that constructs the GUI; we have the same choice in GtkAda. I'm going with the recommended approach to make sure I know what its advantages are before I give up on it. For example, that might be the best way to allow skin customizations, which is a nice feature. > A GTKAda binding to that mess would be nice ... > (though probably difficult to impossible) Why would that be nice? So far, the Android windowing stuff is _far_ cleaner and easier to use than the equivalent GtkAda stuff. I don't have to immediately do unsafe type conversions to write marshallers for my app event handlers; that's all hidden. All I have to do is declare an overriding implementation of a JVM class method. I'm sure I will run into limitations with this method; I'm already having trouble keeping track of what thread each method call is running in (the API docs are _not_ clear about that; I'm assuming anything called a "callback" can be running in a different thread than the read of the app). In fact, I'm thinking of writing a similar music player for Windows, using the JVM and Java windowing stuff there. It may not be as clean as Android, but it would be hard to be much worse than Gtk. The alternative would be to try to write a plugin for VLC or one of the other existing players: I have not looked into that yet, so I don't know what GUI kit they use. > Meanwhile, I think getting the ACATS suite to pass on Android is quite > impressive. Kudos to jrmarino. That is good, but not my need at the moment. > Here, I have FreeBSD going in VirtualBox on my laptop, and am working > through installing the tools via ports. (GTK took 24 hours building > several hundred packages from source; and now GPS insists on building an > obsolete GCC4.5.x before it will install...) > > Then my cheap Flytouch pad is only Android 2.2(Froyo). I may have to look > around for an upgrade to 2.3... > > I'll report if/when I have a HelloWorld running. I'm talking about the full Android windowing Hello World at http://developer.android.com/resources/tutorials/hello-world.html. _not_ just Ada.Text_IO.Put_line. > But I think we're close. You are way overly optimistic. But that's a necessary attitude in this business :). -- -- Stephe