Loading...
Logo
Processing Forum
Michael's Profile
2 Posts
0 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    Hi folks,

    I am using a Galaxy S4 with Ketai v9.

    The orientation of the KataiCam image is correct in landscape mode, but in portrait mode is 90 degrees counterclockwise rotated.

    This is more of a feature request than anything else... can a method be added to KetaiCam class to set the orientation of the camera? The Android.hardware.camera class does have a setDisplayOrientation method so this feature seems possible and would save people having to do it themselves, e.g. by writing to a PGraphics object. It may be more efficient as well.

    Mike


    Hi folks,

    I am hoping that someone can clarify how to read files from a processing project's data folder on Android. I have the following sample code:

    1. import java.io.BufferedReader;
    2. import java.io.FileReader;
    3. import java.io.IOException;
    4. void setup() {
    5.   BufferedReader br;
    6.   String line;
    7.   try {
    8.      br = new BufferedReader(new FileReader(dataPath("sample.txt")));
    9.      while((line=br.readLine())!=null){
    10.        System.out.println(line);
    11.      }
    12.   } catch (Exception e) {
    13.      System.out.println("IOException when trying to read sample.txt:\n"+e);
    14.      System.exit(0);
    15.   }
    16. }

    This works fine when running processing on desktop mode, and it successfully finds and prints out sample.txt. However, when running on the Emulator under Android mode, I get a file not found exception:


    IOException when trying to read sample.txt:
    java.io.FileNotFoundException: /data/data/processing.test.gpa/files/data/sample.txt (No such file or directory)

    Either the problem is that dataPath() is not returning the correct path on Android mode or the files in the data folder are not being transferred correctly. The "/data/data..." part of the pathname looks unusual to me and I'll look at it a bit more later, but I thought I would post something here first. I'm using Processing 2.0.1 with the v10 Android SDK installed. Any ideas?

    Thanks

    Mike