How to use image assets in Android Studio?

Hi. I've been happily learning to use Processing in Android Studio, using the info here - https://github.com/processing/processing-android/wiki - but I've now hit a road block.

Has anyone used Processing in Android Studio, and successfully imported image assets?

The only guidance on the link above is that 'PImage.image is PImage.bitmap, to reflect that a different object type is there, in spite of its identical purpose.' I don't understand what that means, as I can't see a way of using 'bitmap' in PImage.

I'm currently crashing when I do the following:

PImage bg_texture_2

Setup:

bg_texture_2 = requestImage("bg_texture.png");

Draw:

if (bg_texture_2.width == 0) { // Image is not yet loaded }

else if ( bg_texture_2.width == -1) {

// Image throws an error - this is what normally happens.

}

else {

// Image is ready to go, draw it // image( bg_texture_2, 0, 0, 100, 100); // Even with this commented out, I crash

}

}

The error tends to be that it 'can't find bg_texture.png', but I don't know how that can be - I've put it in every conceivable directory. Is there some special way that Android Studio needs the image to be referenced?

Any help would be very gratefully received.

Thanks,

  • Josh
Sign In or Register to comment.