Tuesday, September 11, 2012

PhoneGap Android, jQuery Mobile, HTML5 Canvas, and Touch-based Drawing


This is the PhoneGap version of the jQuery Mobile touch-based drawing programing. For the most part all of the HTML and JavaScript remains the same between the two versions. There are only a few difference which should be explained. If you haven't read the previous post, you should before continuing.


jQuery Mobile, HTML5 Canvas, & Touch-based Drawing.

Orientation

The easiest way to handle orientation in an Android application is not to,simply supporting portrait would be enough. So I made the following change to the <activity> tag in the manifest:


  <activity
    android:name=".MainActivity"
    android:screenOrientation="portrait"
    android:label="@string/title_activity_main" >

Since we don't seem to receive orientationchange events from within the app's code I removed the event handler for it and the resize event. 

Other than those two changes the rest of the code was lifted as is from the web version of the application. The complete source code is in my GitHub repo. It is for Android and the Eclipse IDE. Hopefully a little later in the week I will do a Intellij IDEA version and also the iOS version.