the controlP5 library works fine on pc but on android smartphones there is touch issue the sliders conflicted with each other because using touch not mouse for instance if you drag slider bar and left it then touch else where on lcd the slider still activated and change its position
i made my first project for android but i was using pc when i transferred to android on my tablet i was shocked did not expected the slider issue
after month of searching i find how to make it done
i have found other forked library i use it at first its was same as the original controlP5 library but i run example by chance on my tablet i have noticed that there is no issue with sliders or buttons while activated the slider if you touch any where of lcd slider still stable and not conflicted it was just one example behave so and all others examples just like the controlP5 library the sliders and buttons suffering same issue
i study the example and fined what prevent the slider from moving while you touch any part of tablet lcd
here is the library
Rea-lity-Tech/Skatolo
Skatolo a ControlP5 for for MultiTouch, Augmented Reality and JRubyArt
its controlP5 library cloned
and here is the example
import tech.lity.rea.skatolo.*;
import tech.lity.rea.skatolo.gui.controllers.*;
Skatolo skatolo;
int myColor = color(0,0,0);
int sliderValue = 100;
int sliderTicks1 = 100;
int sliderTicks2 = 30;
Slider abc;
void setup() {
size(700,400);
noStroke();
skatolo = new Skatolo(this);
// add a horizontal sliders, the value of this slider will be linked
// to variable 'sliderValue'
skatolo.addSlider("sliderValue")
.setPosition(100,50)
.setRange(0,255)
;
// create another slider with tick marks, now without
// default value, the initial value will be set according to
// the value of variable sliderTicks2 then.
skatolo.addSlider("sliderTicks1")
.setPosition(100,140)
.setSize(20,100)
.setRange(0,255)
.setNumberOfTickMarks(5)
;
// add a vertical slider
skatolo.addSlider("slider")
.setPosition(100,305)
.setSize(200,20)
.setRange(0,200)
.setValue(128)
;
// reposition the Label for controller 'slider'
skatolo.getController("slider").getValueLabel().align(skatolo.LEFT, skatolo.BOTTOM_OUTSIDE).setPaddingX(0);
skatolo.getController("slider").getCaptionLabel().align(skatolo.RIGHT, skatolo.BOTTOM_OUTSIDE).setPaddingX(0);
skatolo.addSlider("sliderTicks2")
.setPosition(100,370)
.setWidth(400)
.setRange(255,0) // values can range from big to small as well
.setValue(128)
.setNumberOfTickMarks(7)
.setSliderMode(Slider.FLEXIBLE)
;
// use Slider.FIX or Slider.FLEXIBLE to change the slider handle
// by default it is Slider.FIX
}
void draw() {
background(sliderTicks1);
fill(sliderValue);
rect(0,0,width,100);
fill(myColor);
rect(0,280,width,70);
fill(sliderTicks2);
rect(0,350,width,50);
println("Mouse : "+ skatolo.getMouseX() + " " + skatolo.getMouseY() );
println("Mouse2 : "+ mouseX + " " + mouseY );
}
void slider(float theColor) {
myColor = color(theColor);
println("a slider event. setting background to "+theColor);
}
if you add this line from the code to any other example or other code of you own the touch issue will gone from tablet or phone or any lcd touch device this line in the example
println("Mouse : "+ skatolo.getMouseX() + " " + skatolo.getMouseY() );
println("Mouse2 : "+ mouseX + " " + mouseY );
adding this to any sketch using this library solves touch issue
for any question just ask
have fun