Android and Processing - 3D Photo Display

I'm learning to write Android apps using both Eclipse and Android Studio. As a fan of the Processing language and platform, I recently found out I can generate an Android app written in Processing too. Processing is a programming environment based on Java for artists and designers. The Processing IDE (Integrated Development Environment) has an alternate output mode for generating Android apps in addition to generating Java applets and applications. There are a number of Android limitations when using Processing, but I think it is pretty cool to be able to write a program in Processing and run it on my Android phone and tablets.

More about installing Processing and writing code for Android can be found at

I wrote a simple test program in Processing to display a photo on my Android phones and tablets.

Simple photo display test for Android device
Written by Andy Modla
String filename;
PImage photo;
void setup() {
    // DO NOT call size() for Android devices!!
    //filename= "walksequence_1920x1080.jpg";
    filename ="hwS14037C.JPG";
    println("displayWidth="+displayWidth + " displayHeight="+displayHeight);
void getImage() {
    photo = loadImage(filename);
    if (photo.width > photo.height)
    image(photo, 0, 0, displayWidth, displayHeight);
    println( "Image width="+photo.width + " height="+photo.height);
void draw() {
To install this app on my Android devices, I  first had to reconfigure the tablet or phone in developer mode. This was done by pressing the Settings->About Tablet->Android version label 7 times to see the Settings->Developer Options screen. Then I set USB debugging mode. See for details.

Prior to installing an app from my Windows 7 PC I also had to have USB device drivers installed. By installing PDANet for Android software, hard to find drivers were installed for all my Android tablet devices. For Sony, I used the Sony phone support site USB driver.

Processing makes it very easy to compile, install, and run a Processing sketch as an Android app on the device. Just press "Run on Device" with the tablet connected to the computer via USB cable.

With the above test program running on my Inferno 3D tablet, could I display a 3D photo too?

Since I do not yet know what code to use to set 3D display mode on the tablet using Processing or Java, I did it in a round about way. My solution was to first install the Gadmei 3D Activator app to allow me to toggle/change hardware mode in the tablet to 3D mode. Next the 3D photo used in the test was reworked in Stereo Photo Maker to

1) Resize to 1280x752  with Keep aspect ratio with border option set. The display size is actually 1280x800, but the system menu stays on the screen, so the photo size was adjusted instead of removing the system menu.

2) change it to "Column Interlaced". This is done by the SPM (Stereo Photo Maker) menu Stereo->Interlaced->Column Interlaced and then save as JPG stereo image. When the above app-sketch runs, it displays the photo in 3D after toggling 3D mode on.

The Processing sketch above could be enhanced to resize and interlace the photo before displaying it, but that is for another time. In mean time I'll just use 3DSteroid app.