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 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.


http://ws.amazon.com/widgets/q?rt=tf_cw&ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fronco-20%2F8010%2F34c4e293-16aa-4cdf-8038-60405588f045&Operation=GetDisplayTemplate Amazon.com Widgets

Advertisements

6 thoughts on “PhoneGap Android, jQuery Mobile, HTML5 Canvas, and Touch-based Drawing

  1. Wow, I copied the appropriate code from your Android project into a minimal working iOS phonegap project that I already had, and it worked the first time, on all versions of the iPhone and iPad simulators!

    Your code must be very solid for it to do that.

    Cheers, Jerry

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s