Today we’ll be going through an object-oriented programming demo. I’m going to be using Daniel Shiffman’s example here, since it’s so helpful and clear.
Here is a zip file that includes sketches of the steps that we’ll be going through.
In the zip file attached, there is an example of how to draw the location data that Ketai is giving you. You need to cast the doubles into floats then use those floats to create PVectors. The example is still using the Chicago map and congestion JSON file, but adding the location ellipse (black).
Here are the sketches we’ll be going over today:
For those of you that were working with the Ketai library, here is a simple sketch that uses some of the gestures to change colors. You have to download the Ketai library through Processing by going to Sketch > Import Library > Add Library. Then search for Ketai and install it.
I took home a Nexus tablet, which has Android 4.3 on it, and was able to upload a sketch to it, along with my phone, which has 4.4.4 installed. This was suspicious as we were having trouble in class getting both versions to work.
I believe I’m using an Android Mode build on my computer that is older and more stable than the ones we were downloading today. After looking at a bunch of blogs on the subject, on August 22 Ben Fry even admitted that Android Mode is broken right now in Processing:
But, I can get both versions of Android to work with Processing 2.2.1 using this older version of Android Mode.
Download this version of Android Mode that I have on my computer:
Unzip it and you’ll then want to place this folder in your modes directory. That is in your Processing sketch book (probably in your Documents directory): Processing > modes
Just to be safe, rename the old version/folder we are replacing so we can go back to it if we need. Something like _AndroidMode. Then place the new one that I provided in the modes folder.
Restart Processing, and this should work. If it doesn’t work, you may need to install the Android API for 4.3 or 4.4.2 form the Android SDK Manager: Applications > android-sdk-macosx > tools > android. You need to open this using Terminal. Only install the SDK Platform for each API, not the whole package.
This is what I have installed in the Android SDK Manager:
Tools Folder: Android SDK Tools 23.0.2, Android SDK Platform-tools 20, Android SDK Build-tools 20
Android 4.4W (API 20) folder: SDK Platform
Android 2.3.3 (API 10) folder: SDK Platform
I hope this helps
Here is the PDF from the presentation today: