[Bug] java.lang.RuntimeException: onRequestPermission SaveSettings() already added for this instance

I had to edit the title because it didn’t let me post, the correct title is: “[Bug] java.lang.RuntimeException: onRequestPermissionSaveSettings() already added for this instance”

Hi. So whenever I try to save a file, I need to request a permission to do this, right?
So I do this with a code like this:

requestPermission("android.permission.WRITE_EXTERNAL_STORAGE", "onRequestPermissionSaveSettings");

It is called on an instance of my PApplet.

So as you see, I have a callback function called onRequestPermissionSaveSettings.
It is defined in my PApplet.

When I call the aforementioned requestPermission function once, everything is great – the code is run and the file is saved.

When I call it the second time, though, it gives out this error:

W/System.err: java.lang.RuntimeException: onRequestPermissionSaveSettings() already added for this instance of com.kitulous.chineselearn2.app.App
        at processing.core.PApplet.die(PApplet.java:2836)
        at processing.core.PApplet$RegisteredMethods.add(PApplet.java:1047)
        at processing.core.PApplet.registerWithArgs(PApplet.java:1170)
        at processing.core.PApplet.requestPermission(PApplet.java:744)
        at processing.core.PApplet.requestPermission(PApplet.java:739)
        at /* my app code that calls requestPermission function */

So I presume the error is in the Processing for Android code.
Well, I guess, since in PApplet#registerWithArgs(String, Object, Class<?>[]) it adds a method without checking if it’s already there (and it definitely is already there since I have already called that function previously).

@Kitulous === i dont undestand why you write “each time i want to save a file…” - If the permission was granted once (for externalStorage"); you dont have to ask again… So you can add a method verifying that the permission is already granted, that 's all.