Oh No, APwidgets again


#1

I am trying to add buttons(APwidgets) and stuff to my app that is built on processing for android. I got it to upload to my tablet using the android mode processing3, but it crashed. I exported it so I could tweak it in Android Studio. It still crashes but I get a little more info as to what is going wrong.

Heres the message:

java.lang.NoSuchMethodError: No virtual method runOnUiThread(Ljava/lang/Runnable;)V in class Lprocessing/core/PApplet; or its super classes (declaration of ‘processing.core.PApplet’ appears in /data/app/processing.test.apwidgetstext-1/base.apk)

I’d like to fix the problem, but I don’t understand it. I’ll modify the source for APwidgets if I know where to start. Thanks for any clues.


#2

There is recently involvement of one community member to get APwidgets going again: Using Sound in Android

However, the owner of the repo might not be around supporting this project anymore. If you want to add buttons, have you consider using Android widgets instead? Check these:

https://forum.processing.org/two/discussion/14206/on-screen-buttons-without-apwidgets
https://forum.processing.org/two/discussion/18606/creating-native-android-menus-in-processing-android-mode

Give it a try. it is not that difficult. at least, it is easier than modifying the APwidget source code.

Kf


#3

Thank You, @kfrajer I tried it and the second link(buttons without APwidgets) is really helpful. Now I need to expand on that so pressing a button does something. My gut says I need to know how to start and stop threads. Press a button and one thread runs, press another and it stops and a different one starts.


#4

@HackinHarry===
no; you have only to add a listener to the button:

monBouton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {

  //what you want
        
    }
});