Hi, folks!
This is my first post on the forum, so i hope i can find the solution of my issue.
I was using controlp5 and ketai libraries.
My code:
import ketai.net.bluetooth.*;
import ketai.ui.*;
import ketai.net.*;
import ketai.sensors.*;
import controlP5.*;
KetaiBluetooth bt;
KetaiList klist;
KetaiSensor sensor;
ControlP5 cp5;
ArrayList devicesDiscovered = new ArrayList();
byte[] a={'r'};
byte[] b={'g'};
byte[] c={'b'};
byte redValue = 0;
byte greenValue = 0;
byte blueValue = 0;
void setup()
{
size(displayWidth,displayHeight);
orientation(LANDSCAPE);
background(0);
cp5=new ControlP5(this);
cp5.addSlider("redValue")
.setPosition(50, 40)
.setSize(250, 550)
.setRange(0.0,255.0)
;
cp5.addSlider("greenValue")
.setPosition(500, 40)
.setSize(250, 550)
.setRange(0.0,255.0)
;
cp5.addSlider("blueValue")
.setPosition(950, 40)
.setSize(250, 550)
.setRange(0.0,255.0)
;
cp5.getController("redValue").getValueLabel().align(ControlP5.RIGHT, ControlP5.TOP).setPaddingY(0);
cp5.getController("redValue").getCaptionLabel().align(ControlP5.LEFT, ControlP5.BOTTOM).setPaddingY(0);
cp5.getController("greenValue").getValueLabel().align(ControlP5.RIGHT, ControlP5.TOP).setPaddingY(0);
cp5.getController("greenValue").getCaptionLabel().align(ControlP5.LEFT, ControlP5.BOTTOM).setPaddingY(0);
cp5.getController("blueValue").getValueLabel().align(ControlP5.RIGHT, ControlP5.TOP).setPaddingY(0);
cp5.getController("blueValue").getCaptionLabel().align(ControlP5.LEFT, ControlP5.BOTTOM).setPaddingY(0);
bt=new KetaiBluetooth(this);
bt.start();
klist = new KetaiList(this, bt.getDiscoveredDeviceNames());
}
void draw()
{
}
void onKetaiListSelection(KetaiList klist1)
{
String select = klist1.getSelection();
bt.connectToDeviceByName(select);
klist = null;
}
void redValue(byte[] rV)
{
bt.broadcast(a);
bt.broadcast(rV);
}
void greenValue(byte[] gV)
{
bt.broadcast(a);
bt.broadcast(gV);
}
void blueValue(byte[] bV)
{
bt.broadcast(a);
bt.broadcast(bV);
}
And my error :
java.lang.IllegalStateException: Fragment rgb_por{41ca2a10} not attached to Activity at android.app.Fragment.startActivityForResult(Fragment.java:1072) at android.app.Fragment.startActivityForResult(Fragment.java:1063) at ketai.net.bluetooth.KetaiBluetooth.(KetaiBluetooth.java:99) at processing.test.rgb_por.rgb_por.setup(rgb_por.java:82) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:841) FATAL EXCEPTION: Animation Thread Process: processing.test.rgb_por, PID: 28464 java.lang.IllegalStateException: Fragment rgb_por{41ca2a10} not attached to Activity at android.app.Fragment.startActivityForResult(Fragment.java:1072) at android.app.Fragment.startActivityForResult(Fragment.java:1063) at ketai.net.bluetooth.KetaiBluetooth.(KetaiBluetooth.java:99) at processing.test.rgb_por.rgb_por.setup(rgb_por.java:82) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:841)