EmmanuelPil/Android-java-code-utilities-widgets-for-Processing-for-Android

Remark on FileExplorer

Closed this issue · 1 comments

Hi again.

I have been (trying) pretty much the same, with mixed results...

  • Did you notice (and can explain)that the sketch is terminating, regardless of the selection?
    It still does the println() stuff, but then just exits - no Exception, normalLy..
    On a ' valiid' selection (just a few lines of .txt), it tends to throw
java.lang.RuntimeException: Buffer not large enough for pixels
	at android.graphics.Bitmap.copyPixelsFromBuffer(Bitmap.java:796)
	at processing.a2d.PGraphicsAndroid2D.restoreSurface(PGraphicsAndroid2D.java:2102)
	at processing.a2d.PGraphicsAndroid2D.checkCanvas(PGraphicsAndroid2D.java:217)
	at processing.a2d.PGraphicsAndroid2D.beginDraw(PGraphicsAndroid2D.java:225)
	at processing.core.PApplet.handleDraw(PApplet.java:1782)
	at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:471)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:503)

Some tinkering later:

Seems to be at least partially related to your use of settings/fullscreen:

  • removing settings() and
  • putting fullScreen(P3D) into setup(). P2D seems to be even more buggy and inefficient than PSpplet/PGraphics...alas.

keeps the App running.

Actually too much, as each mousePressed triggers the activity sgain..easy to fix by checking click area...

And now I will have to find out why my app is exiting on a non-RESULT_OK...hoped I could make you figure that out ;-)

And I had different plans for the weekend than fighting Android battles I cant win, too.

So far
Have a good week.

PS: Putting somrthin into draw() seems to help, too

void draw() {
  background(0xff000000|frameCount);
  text("Click on screen", width/2, height/3);
  //if (img_loaded)  image(img, 0, 0);
}

void mousePressed() {  
  if(mouseY<height-height/8)
    searchFile();
}

As commented above the code; it works only up to Kitkat.
To avoid the app exiting I think you can use a try catch block.