Where great old Macs live again!

Android Programming for Apple IIGS and iPhone developers

My son
Ding Wen is porting some of his Apple IIGS and iPhone programs to Google Android phone. There are 2 ways to do it. The first way is to embed a WebKit browser (WebView) to host a web application. The 2nd way is to use
Using WebView Write a web application and tested them to work under Android Browser. If you have already learnt about Complete Pascal or other similar programming languages using QuickDraw,
GScript will gives you a small subset of QuickDraw-like commands and Apple IIGS color palette that allows Apple IIGS programmer to easily port their programs to JavaScript. If you have already written a web application for iPhone, it might just work with Android! Create an Android project. Copy all HTML, JavaScript and related files into the
assets folder. In the Java source file in the
src folder, add 2 import statements:
import android.view.*; import android.webkit.*; Change the content of the
onCreate method to:
super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); WebView webView = new WebView(this); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("file:///android_asset/index.html"); setContentView(webView); This code assuming the HTML file name to be index.html - change as you will. You can now compile and get a running application on your Android phone!

Using Canvas Writing web application is not the best way to do Android programming - a better way is to use
Canvas. This means you will need to learn Java and the Android API - but it isn't hard. Java code is similar to JavaScript or Pascal, and the Canvas API is really simple. Within a few hours and some sample codes, Ding Wen finally created his first Java program - an
animation program he initially written for the Apple IIGS.

Ding Wen has already written some native applications using Java.

Have fun!

Views: 1012


You need to be a member of RetroMacCast to add comments!

Join RetroMacCast



© 2021   Created by James.   Powered by

Badges  |  Report an Issue  |  Terms of Service