Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

How do a get image files on to my android?

$
0
0

Howdy, I'm new to processing and new to Androi so I suspect i have a conceptual block here. I've written a very simple routine that is trying to load a background image. Code Follows. It runs fine in Java but when I try to run it on the Android Emulator I'm getting a

java.io.FileNotFoundException: /data/user/0/processing.test.wrapmate/files/bg.jpg (No such file or directory)

I'm assuming this is because my image file is sitting on my computer and not on my Device (either a real one or the Emulator).

So a) during development, what's the way to get any image files I need to access to the right place on the Android so that the program can access them?

b) If I eventually want to "deploy" an app to my friend's devices (like through the App Store?) how do I ensure that any image files come along with the application?

Thanks!

Dave

edit... trying to learn to format code in the forum. Sorry!

void setup()
{
  size(displayWidth, displayHeight, P3D);
}

void draw()
{
  //noStroke();
  PImage back;
  back = loadImage("bg.jpg");
  back.resize (displayWidth, displayHeight);
  background(back);

  float box_width = 60;

  if (mousePressed) {
    box_width = mouseX;
  }

  lights();
  translate(width/2, height/2, 0);
  rotateX(-PI/6);
  rotateY(PI/2 + 210/float(height) * PI);
  box(box_width, displayHeight/6, displayWidth/3);
}

Viewing all articles
Browse latest Browse all 941

Trending Articles