Hello!
How can I access the device's xppi and yppi to make my app compatible with all devices?
Thanks!
Hello!
How can I access the device's xppi and yppi to make my app compatible with all devices?
Thanks!
Hi, I am not very familiar with the android mode, but I need to use ble communication, so I was hoping to use the blepdroid library. I downloaded, and placed it in my library folder, opened the examples... and tried to run them. I don't have the rfduino that should be communicating with it, but was expecting it to just fail to connect.
However, the sketch can't run. It builds correctly, but I get a fatal exception java.lang.RuntimeException: Unable to start activity
I tried making a sketch with almost all the code stripped away to see if it works better. But it is enough that there is blepdroid = new Blepdroid(this); To make it not work (this time not finding the virtual method getFragmentManager())
Is there something fundamental that I need to set in this mode to make it work? Are the examples from this library supposed to work out of the box?
Thank you.
Have just updated to v14 (was on v10) and I am now getting messages printed to the console for motion events:
motionEvent called inside kgesture and KGesture got a MotionEvent!
Anyway to stop this happening?
Mark
So I recently uploaded my app to the play store and i wanted to implement ads, so I looked up this tutorial and It said I needed the AdMob library, so I went looking for it on the AdMob sites where they say I can get it with the google play service SDK which is great since I can download it with processing
I use the code that is used in the forum post which is this one:
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.widget.RelativeLayout;
import com.google.ads.*;
@ Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow();
RelativeLayout adsLayout = new RelativeLayout(this);
RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
// Displays Ads at the bottom of your sketch, use Gravity.TOP to display them at the top
adsLayout.setGravity(Gravity.BOTTOM);
AdView adView = new AdView(this, AdSize.BANNER, "your-publisher-id"); // add your app-id
adsLayout.addView(adView);
AdRequest newAdReq = new AdRequest();
// Remark: uncomment next line for testing your Ads (fake ads)
//newAdReq.setTesting(true);
adView.loadAd(newAdReq);
window.addContentView(adsLayout,lp2);
}
but now the problem is that I got an error that says this:
The import com.google cannot be resolved
and the console says this:
----------
1. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 9)
import android.content.pm.PackageManager;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import android.content.pm.PackageManager is never used
----------
2. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 11)
import android.support.v4.content.ContextCompat;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import android.support.v4.content.ContextCompat is never used
----------
3. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 13)
import android.app.AlertDialog;
^^^^^^^^^^^^^^^^^^^^^^^
The import android.app.AlertDialog is never used
----------
4. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 14)
import android.content.DialogInterface;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import android.content.DialogInterface is never used
----------
5. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 15)
import android.Manifest;
^^^^^^^^^^^^^^^^
The import android.Manifest is never used
----------
6. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 49)
int check;
^^^^^
The value of the local variable check is not used
----------
----------
7. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 13)
import com.google.ads.*;
^^^^^^^^^^
The import com.google cannot be resolved
----------
8. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 14)
import com.google.android.gms.ads.AdRequest;
^^^^^^^^^^
The import com.google cannot be resolved
----------
9. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 15)
import com.google.android.gms.ads.AdView;
^^^^^^^^^^
The import com.google cannot be resolved
----------
10. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 16)
import com.google.android.gms.ads.AdSize;
^^^^^^^^^^
The import com.google cannot be resolved
----------
11. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 17)
import com.google.android.gms.ads.MobileAds;
^^^^^^^^^^
The import com.google cannot be resolved
----------
12. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 60)
AdView adView = new AdView(this.getActivity());
^^^^^^
AdView cannot be resolved to a type
----------
13. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 60)
AdView adView = new AdView(this.getActivity());
^^^^^^
AdView cannot be resolved to a type
----------
14. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 61)
adView.setAdSize(AdSize.BANNER);
^^^^^^
AdSize cannot be resolved to a variable
----------
15. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 64)
AdRequest newAdReq = new AdRequest.Builder()
^^^^^^^^^
AdRequest cannot be resolved to a type
----------
16. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 64)
AdRequest newAdReq = new AdRequest.Builder()
^^^^^^^^^
AdRequest cannot be resolved to a type
----------
16 problems (10 errors, 6 warnings)
BUILD FAILED
C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\build.xml:15: The following error occurred while executing this line:
C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\build.xml:28: Compile failed; see the compiler error output for details.
What did I do wrong I installed the google play service SDK through the default SDK manager.
Hi there, i try to use control P5 toggle with Android, the problem with this object is that the mouseover status inside android become another time to touch to activate the same toggle, one for the mouseover status and one to hit the toggle. How can i disable the mouseover step for the controlP5 toggle? Thanks a lot
A few questions ... as a result of having used Ketai up to now for gestures, but finding that either it or AndroidMode 4 (or both) are incompatible I am now in need of some new solution, I think?
I see that there are some new functions for touches in the Anrdoid Mode 4 reference. Touches Array is a great addition!
Basic questions ... for Android Mode ...
Does touchStarted() now replace mousePressed() ? Does touchMoved() now replace mouseMoved() ? Does touchEnded() now replace mouseReleased() ?
... when using AndroidMode 4? Can they be used alongside one another ... or best not to?
This is all great, but is there anything available or planned as equivalents to Ketai callbacks for onTap(), onFlick() and onPinch(), all of which are pretty basic needs for an android app? No worries if not... I will see if I can write my own... but ... if ... ??
Can't say how much I still appreciate all the work that is put into this project by so many people!
Mark
Hello all!
I am new to coding, been only doing it daily for a month or two, and I just finished my first game for android. I would like to add it to the Google Play Store with AdMob. I have registered for AdMob, and now I need to incorporate the ads to my code, however, I have no idea how to do that.
I already saw https://forum.processing.org/two/discussion/16686/how-to-add-admob and I read through all of it twice, but am still completely at a loss. The topic is really messy and riddled with trials and errors, and has code and symbols that I have never used nor understood at all, making its contents practically unreadable for someone with as little coding experience as me. What is a manifest? What's a .jar file, why do I need it and where do I get it?
I put so much effort into my game and I am so eager to see it in the store, but I just can't get past this final step.
If some kind soul could give me and, likely, the thousands of other newcomers looking for an answer, a step-by-step walkthrough of exactly what I need to download, where I need to download it, and provide an organized snippet of code that I can adapt for my program, words can't describe how grateful I would be.
Thank you all in advance!
Hi everyone!
I'm trying since 2 days to add some processing code in my android devices (through the Android mode) only for fun...
The issue is that processing doesn't detect my phones (Wiko Sunny and Archo 35b Titanium) while my laptop do...
However, I turned on the usb debbuging mode, and I tryied to change the usb connection setting of the device (switching between Media Transfert and Photo Transfert)...
I got the lastest versions of Processing and the Android mode (I installed the SDK with processing)
My pc is on Windows 8.1
I have no idea of how could I fix it :-(
Hi there, past days with the special help of this forum i archive some tools such toggle and button, i need it for multitouch purpose on android, i understand that mouse parameter are not correct for multitouch, i already read what there is on processing android site but i phish to obtain a little help to convert this class for android multi touch purpose. Thanks a lot
class Toggle {
boolean state;
boolean ready;
boolean blink;
int x, y, w, h, delta; // x,y,w,h
Toggle(int ix, int iy, int iw, int ih) {
blink = false;
state = false;
ready = true;
x = ix;
y = iy;
w = iw;
h = ih;
}
void draw() {
if(blink == true){delta = 32;} else {delta = 0;}
if ( mousePressed ) {
if (ready && mouseX >= x && mouseX <= (x+w) && mouseY >= y && mouseY <= (y+h) ) {
ready = false;
state = !state;
}
} else {
ready = true;
}
fill(63+delta);
if (state) {
fill(127+delta);
}
rect(x, y, w, h);
}
}
Hey all!
I recently coded a game on Processing Android. It is riddled with animated objects and arraylists of them. It seems to run smoothly on my Samsung Galaxy J3, but when ran on an old Samsung tablet, the game crashes. I have narrowed down the reason to all the arraylists - if I set them to only 2-3 objects each, it is still laggy, but it doesn't crash. If I add more, it crashes after a few seconds.
I am using a P2D render for all of the game. Could that be an issue? Do I need a JAVA2D render for the calculations?
So, I have a live wallpaper that only realistically needs 5 fps to run. Would lowering the framerate actually be helpful for battery, cpu, gpu etc.., or would there not be a noticeable difference from a regular framerate
Hello, Sorry for my english, I am French and I use Google traduction, it should not be very effective, so thank you very much to read me ! Here is my problem: Since 3 days, I am fighting with Processing and Android Studio, because I want to export an application apk on my phone (samsung galaxy s3, Android 4.1.1, API16). I click "Export Android Project", and I open Android Studio, then I choose "Import Project", and "Build, Generate Signed APK", and I copy/paste my app.APK on my phone. When I click on, there is an error message "Probleme lors de l'analyse de l'ensemble". On the Internet, I saw other people who have this problem, but they were unable to resolve it, because, according to them, that is the API version of SDK for Processing (Android 8.0.0, API 26!) which is too recent for this phone(Android 4.1.1 API 15 or 16). So the only way is to change my phone? There is maybe another solution please ?! Thank you !
Edit : My Processing Version is 3.3.6 and I am on Windows 7
Hi there! I know that libpd can be useful inside android to send midi messages thru onboard miniusb , i ask if supercollider lib for processing can also do the same: talk with processing and send midi via mini usb android onboard Thanks a lot!
It's my understanding that after you install processing-android, there's a pop-up that looks like this:
. I don't get that. Everything in the pane is white with no text. It looks like this:
.'
I am running Ubuntu 17.04 with i3-gaps. I'm using processing 3.3.6 with android-mode 4.0.
Any help you could give would be fantastic. Thanks
Hi there, I would like to convert the following midi sequencer to android An error occurred; Failed resolution of: Ljavax/sound/midi/MidiSystem I think something wrong around MidiBus, The sketch never open it's self on my phone. There is someone who could help me?
Thanks a lot! Giammy
import controlP5.*;
import themidibus.*;
int outDeviceNum = 1;
MidiBus midiBus;
ControlP5 cp5;
Knob myKnobA;
int col = color(255);
int slot = 16;
IntList inv;
int[] t = new int [16];
boolean START = true;
int myColor = color(255);
int c1,c2;
float n,n1;
boolean t20 = true;
boolean t50 = true;
boolean t80 = false;
boolean t110 = false;
boolean t140 = false;
boolean t170 = false;
boolean t200 = false;
boolean t230 = false;
boolean t260 = false;
boolean t290 = false;
boolean t320 = false;
boolean t350 = false;
boolean t380 = false;
boolean t410 = false;
boolean t440 = false;
boolean t470 = false;
int incr = 0;
void setup() {
size(860, 540, JAVA2D);
MidiBus.list();
midiBus = new MidiBus(this, -1, outDeviceNum);
//pixelDensity(displayDensity());
//smooth();
cp5 = new ControlP5(this);
cp5.setColorBackground(color(89,89,89));
cp5.setColorForeground(color(140,140,140)); //Qty & rim color
cp5.setColorActive(color(217,217,217)); //Selected items
for (int i = 20; i < 490; i = i+30) {
cp5.addToggle("t"+i)
.setPosition(i, 20)
.setSize(20, 20)
.setCaptionLabel("")
.setColorValue(100)
;
}
// myKnobA = cp5.addKnob("slot")
// .setRange(1, 16)
//.setValue(20)
// .setPosition(510, 10)
//.setRadius(20)
//.setDragDirection(Knob.VERTICAL)
//;
cp5.addToggle("start")
.setPosition(830, 512)
.setSize(20, 20)
.setCaptionLabel("PLAY")
;
cp5.addButton("slot2")
.setValue(0)
.setPosition(100,100)
.setSize(30,20)
;
cp5.addButton("slot3")
.setValue(0)
.setPosition(500,20)
.setSize(30,20)
;
}
void draw() {
//frameRate(8);
delay(120);
t[0]= int(t20);
t[1]= int(t50);
t[2]= int(t80);
t[3]= int(t110);
t[4]= int(t140);
t[5]= int(t170);
t[6]= int(t200);
t[7]= int(t230);
t[8]= int(t260);
t[9]= int(t290);
t[10]= int(t320);
t[11]= int(t350);
t[12]= int(t380);
t[13]= int(t410);
t[14]= int(t440);
t[15]= int(t470);
background(38,38,38);
if (incr > slot) {
incr = 0;
};
if (t[incr] == 1) {
sendNote(0, 36, 100, 100);
}
incr ++;
noStroke();
fill(217, 217, 217);
rect(18+((incr-1)*30), 18, 24, 24);
}
//void slot(int theValue) {
// slot = theValue-1;
//}
public void sendNote(final int channel, final int pitch, final int velocity, final int duration) {
Thread thread = new Thread(new Runnable() {
public void run() {
//println("sending note c:"+channel+" p:"+pitch+", v:"+velocity+", d:"+duration+", ");
midiBus.sendNoteOn(channel, pitch, velocity);
delay(duration);
midiBus.sendNoteOff(channel, pitch, velocity);
}
}
);
thread.start();
}
void slot2() {
slot = slot-1;
if(slot ==-1){slot = 0;}
}
void slot3() {
slot = slot+1;
if(slot ==16){slot = 15;}
}
// function colorA will receive changes from
// controller with name colorA
//public void colorA(int theValue) {
// println("a button event from colorA: "+theValue);
// slot = slot-1;
//c2 = color(0,160,100);
//}
/*
a list of all methods available for the Toggle Controller
use ControlP5.printPublicMethodsFor(Toggle.class);
to print the following list into the console.
You can find further details about class Toggle in the javadoc.
Format:
ClassName : returnType methodName(parameter type)
controlP5.Toggle : Toggle setMode(int)
controlP5.Toggle : Toggle setState(boolean)
controlP5.Toggle : Toggle setValue(boolean)
controlP5.Toggle : Toggle setValue(float)
controlP5.Toggle : Toggle toggle()
controlP5.Toggle : Toggle update()
controlP5.Toggle : boolean getState()
controlP5.Controller : CColor getColor()
controlP5.Controller : ControlBehavior getBehavior()
controlP5.Controller : ControlWindow getControlWindow()
controlP5.Controller : ControlWindow getWindow()
controlP5.Controller : Controller addCallback(CallbackListener)
controlP5.Controller : Controller addListener(ControlListener)
controlP5.Controller : Controller hide()
controlP5.Controller : Controller linebreak()
controlP5.Controller : Controller listen(boolean)
controlP5.Controller : Controller lock()
controlP5.Controller : Controller plugTo(Object)
controlP5.Controller : Controller plugTo(Object, String)
controlP5.Controller : Controller plugTo(Object[])
controlP5.Controller : Controller plugTo(Object[], String)
controlP5.Controller : Controller registerProperty(String)
controlP5.Controller : Controller registerProperty(String, String)
controlP5.Controller : Controller registerTooltip(String)
controlP5.Controller : Controller removeBehavior()
controlP5.Controller : Controller removeCallback()
controlP5.Controller : Controller removeCallback(CallbackListener)
controlP5.Controller : Controller removeListener(ControlListener)
controlP5.Controller : Controller removeProperty(String)
controlP5.Controller : Controller removeProperty(String, String)
controlP5.Controller : Controller setArrayValue(float[])
controlP5.Controller : Controller setArrayValue(int, float)
controlP5.Controller : Controller setBehavior(ControlBehavior)
controlP5.Controller : Controller setBroadcast(boolean)
controlP5.Controller : Controller setCaptionLabel(String)
controlP5.Controller : Controller setColor(CColor)
controlP5.Controller : Controller setColorActive(int)
controlP5.Controller : Controller setColorBackground(int)
controlP5.Controller : Controller setColorCaptionLabel(int)
controlP5.Controller : Controller setColorForeground(int)
controlP5.Controller : Controller setColorValueLabel(int)
controlP5.Controller : Controller setDecimalPrecision(int)
controlP5.Controller : Controller setDefaultValue(float)
controlP5.Controller : Controller setDisplay(ControllerDisplay)
controlP5.Controller : Controller setHeight(int)
controlP5.Controller : Controller setId(int)
controlP5.Controller : Controller setImages(PImage, PImage, PImage)
controlP5.Controller : Controller setImages(PImage, PImage, PImage, PImage)
controlP5.Controller : Controller setLabelVisible(boolean)
controlP5.Controller : Controller setLock(boolean)
controlP5.Controller : Controller setMax(float)
controlP5.Controller : Controller setMin(float)
controlP5.Controller : Controller setMoveable(boolean)
controlP5.Controller : Controller setPosition(PVector)
controlP5.Controller : Controller setPosition(float, float)
controlP5.Controller : Controller setSize(PImage)
controlP5.Controller : Controller setSize(int, int)
controlP5.Controller : Controller setStringValue(String)
controlP5.Controller : Controller setUpdate(boolean)
controlP5.Controller : Controller setValueLabel(String)
controlP5.Controller : Controller setVisible(boolean)
controlP5.Controller : Controller setWidth(int)
controlP5.Controller : Controller show()
controlP5.Controller : Controller unlock()
controlP5.Controller : Controller unplugFrom(Object)
controlP5.Controller : Controller unplugFrom(Object[])
controlP5.Controller : Controller unregisterTooltip()
controlP5.Controller : Controller update()
controlP5.Controller : Controller updateSize()
controlP5.Controller : ControllerProperty getProperty(String)
controlP5.Controller : ControllerProperty getProperty(String, String)
controlP5.Controller : Label getCaptionLabel()
controlP5.Controller : Label getValueLabel()
controlP5.Controller : List getControllerPlugList()
controlP5.Controller : PImage setImage(PImage)
controlP5.Controller : PImage setImage(PImage, int)
controlP5.Controller : PVector getAbsolutePosition()
controlP5.Controller : PVector getPosition()
controlP5.Controller : String getAddress()
controlP5.Controller : String getInfo()
controlP5.Controller : String getLabel()
controlP5.Controller : String getName()
controlP5.Controller : String getStringValue()
controlP5.Controller : String toString()
controlP5.Controller : Tab getTab()
controlP5.Controller : boolean isActive()
controlP5.Controller : boolean isBroadcast()
controlP5.Controller : boolean isInside()
controlP5.Controller : boolean isListening()
controlP5.Controller : boolean isLock()
controlP5.Controller : boolean isMouseOver()
controlP5.Controller : boolean isMousePressed()
controlP5.Controller : boolean isMoveable()
controlP5.Controller : boolean isUpdate()
controlP5.Controller : boolean isVisible()
controlP5.Controller : float getArrayValue(int)
controlP5.Controller : float getDefaultValue()
controlP5.Controller : float getMax()
controlP5.Controller : float getMin()
controlP5.Controller : float getValue()
controlP5.Controller : float[] getArrayValue()
controlP5.Controller : int getHeight()
controlP5.Controller : int getId()
controlP5.Controller : int getWidth()
controlP5.Controller : int listenerSize()
controlP5.Controller : void remove()
controlP5.Controller : void setDisplay(ControllerDisplay, int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
*/
Hey all!
I have gone through every topic on the subject and tried every example, but I always get the exception message and sound fails to load. I have tried the go-to example:
import android.media.MediaPlayer;
import android.content.res.AssetFileDescriptor;
import android.content.Context;
import android.app.Activity;
/////////////////////////////////////////////////////////
MediaPlayer mp;
Context context;
Activity act;
AssetFileDescriptor afd;
void setup() {
act = this.getActivity();
context = act.getApplicationContext();
try {
mp = new MediaPlayer();
afd = context.getAssets().openFd("MYSOUND.mp3");//which is in the data folder
mp.setDataSource(afd.getFileDescriptor());
mp.prepare();
}
catch(IOException e) {
println("file did not load");
}
mp.start();
};
void draw() {
};
As well as the more complex examples:
import java.io.File;
import java.io.IOException;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnPreparedListener;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.content.res.AssetManager;
import android.content.Context;
import android.app.Activity;
import android.os.Bundle;
import android.app.Application;
/////////////////////////////////////////////////////////
MediaPlayer mp;
public boolean loop = true;
AssetManager am;
Context context;
boolean premiere = false;
Activity act;
AssetFileDescriptor afd;
boolean AppliAndroid = false;
public void setup(){
orientation(PORTRAIT);
background(255,0,0);
fill(255);
textSize(24);
text("SONG IS PLAYING", 200,300);
act = this.getActivity();
context = act.getApplicationContext();
// testClass();
try {
mp = new MediaPlayer();
afd = context.getAssets().openFd("MYSOUND.mp3");//which is in the data folder
mp.setDataSource(afd.getFileDescriptor());
mp.prepare();
} catch(IOException e) {
println("j'arrive pas à préparer");
}
mp.setLooping(loop);
mp.start();
};
public void draw(){
};
Sound just refuses to load. I get the exception message every time.
Hello,
I am trying to output values from a slider in Android Mode (using the Controlp5 and Ketai libraries) to an Arduino. I am posting my working code (built from some example codes I found online) here for reference. The original code used simple on/off buttons to send characters to the Arduino. I am a newbie, so from building this example I taught myself some basics of how to send characters from the Android over Bluetooth.
Now I would like to send a range of values corresponding to a couple of sliders. I have been able to successfully create the sliders in my code, but I am really struggling to understand how to get these values to output to an Arduino like I did for each button.
I have since gone through and commented out all of the old, unnecessary lines corresponding to the buttons, but I was hoping to use them for reference/modify them to output the slider values.
Any help at all would be greatly appreciated. Thank you.
// reference for basic button control code: http://stormkitz.blogspot.com/ // references for adding sliders: http://wiki.bk.tudelft.nl/toi-pedia/Processing_Buttons_and_Sliders // https://www.kasperkamperman.com/blog/processing-code/controlp5-library-example1/ // http://coretechrobotics.blogspot.com/2013/12/controlling-arduino-with-android-device.html // http://forum.arduino.cc/index.php?topic=194265.0 // http://forum.arduino.cc/index.php?topic=193316.0 import android.content.Intent; import android.os.Bundle; import ketai.net.bluetooth.*; import ketai.ui.*; import ketai.net.*; import controlP5.*; //KZ: slider import cc.arduino.*; //KZ: slider PFont fontMy; //declaring font boolean bReleased = true; //no permament sending when finger lets off the button KetaiBluetooth bt; // Create object from BtSerial class boolean isConfiguring = true; String info = ""; KetaiList klist; ArrayList devicesDiscovered = new ArrayList(); //store in array the discovered device boolean rectOver = false; int rec = 0; ControlP5 controlP5; //KZ: slider Arduino arduino; //KZ: slider int DC_speed = 0; // 0-6 //KZ: slider int DC2_speed = 0; // 0-6 //KZ: slider int DC3_speed = 0; // 0-6 //KZ: slider // The following code is required to enable bluetooth at startup. void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); bt = new KetaiBluetooth(this); //create the BtSerial object that will handle the connection } void onActivityResult(int requestCode, int resultCode, Intent data) { bt.onActivityResult(requestCode, resultCode, data); //to show the discovered device } void **setup**() { size(displayWidth, displayHeight); //size of the phone screen smooth(); frameRate(10); //the frame rate of my screen orientation(PORTRAIT); //vertical bt.start(); //start listening for BT connections isConfiguring = true; //at my phone start select device… fontMy = createFont("SansSerif", 30); //font size textFont(fontMy); controlP5 = new ControlP5(this); controlP5.addSlider("DC_speed",0,6,DC_speed,100,200,50,500); //KZ: slider controlP5.addSlider("DC2_speed",0,6,DC2_speed,330,200,50,500); //KZ: slider controlP5.addSlider("DC3_speed",0,6,DC3_speed,550,200,50,500); //KZ: slider } void **draw**() { //at app start select device if (isConfiguring) { ArrayList names; //create the BtSerial object that will handle the connection //with the list of paired devices klist = new KetaiList(this, bt.getPairedDeviceNames()); isConfiguring = false; //stop selecting device } //else //{ //color a = color(255,0,0); //KZ: red- main axis //color b = color(255,0,0); //KZ: red- main axis //color d = color(255,0,0); //KZ: red- main axis //color i = color(95, 191, 187); //KZ: aqua- background of dots??? //update(mouseX, mouseY); //update our finger point at where of the screen //background(95, 191, 187); //background color //if //((mousePressed)&&(rectOver)&&(rec==2)) //{ d = color(10,237,26); //KZ: changes d from red to green //} //else if ((mousePressed)&&(rectOver)&&(rec==3)) //{ a = color(10,237,26); //KZ: changes a from red to green //} //else if ((mousePressed)&&(rectOver)&&(rec==4)) //{ b = color(10,237,26); //KZ: changes a from red to green //} // if ((rec == 2) && (rectOver)&&(mousePressed) && (bReleased == true)) { // If our finger is on the square, // byte[] data = {'w'}; // send w to arduino when we click the button 2 // bt.broadcast(data); //send with bt //bReleased = false; // send data for once until next time we click the button again // } // if ((rec == 3) && (rectOver)&&(mousePressed) && (bReleased == true)) { // byte[] data = {'a'}; // send a to arduino when we click the button 3 // bt.broadcast(data); //send with bt // bReleased = false; // } // if ((rec == 4) && (rectOver)&&(mousePressed) && (bReleased == true)) { // byte[] data = {'d'}; // send d to arduino when we click the button 4 // bt.broadcast(data); //send with bt // bReleased = false; // } // if((rectOver)&&(mousePressed == false)&& (bReleased == false)) { //when our finger move up from the button, send stop command to arduino // byte[] data = {' '}; // bt.broadcast(data); // bReleased = true; //} //fill(a); //fill each area of button with the color declared above //stroke(162); //the shape covered with a grey color line //triangle(350,600,450,550,350,500); //draw the triangle with the coordinates //KZ: FR //fill(b); //triangle(350,350,450,300,350,250); //KZ: 2x. FL //fill(d); //triangle(150,250,50,300,150,350); //KZ: 4x. BL //} //to print received data and show on screen fill(255); noStroke(); textAlign(LEFT); text(info, 20, 104); noFill(); } //void update(int x, int y) { //to control the flag when we click a button // if ( overRect(350, 500, 100, 100) ) { //x, y, width, height // rectOver = true; // rec = 3; //Confirmed: Front Right //} //else if //( overRect(350, 250, 100, 100) ) { //x, y, width, height // rectOver = true; // rec = 4; //Confirmed: Front Left // } // else if // ( overRect(50, 250, 100, 100) ) { //x, y, width, height // rectOver = true; // rec = 2; //Confirmed: Back Left // } //else // { // rectOver = false; //nothing s touched on screen //} //} //boolean overRect(int x, int y, int width, int height) { //KZ: to scan what area is touched // if (mouseX >= x && mouseX <= x+width &&</span> // mouseY >= y && mouseY <= y+height) //to see if the mouse cursor inside rect</span> //{ // return true; // } else { // return false; // } //} void onKetaiListSelection(KetaiList klist) { String selection = klist.getSelection(); //select the device to connect bt.connectToDeviceByName(selection); //connect to the device klist = null; //dispose of bluetooth list for now } //Call back method to manage data received void onBluetoothDataEvent(String who, byte[] data) { if (isConfiguring) return; //received info += new String(data); if(info.length() > 150) //clean the words on screen if string to long info = ""; }//END of Android processing coding
Hi there, i still try to obtain midi output outside android, and i would ask if there is a way to use the api inside processing has that say for android studio on https://developer.android.com/reference/android/media/midi/package-summary.html thanks a lot
I was wondering if anyone has any tips on finding cheap hardware that will work well with Android for Processing, especially for running stable for longer periods of time.
I know not all hardware even works. In the past I have organized courses on creative coding where people got to take their visual creation home on a tablet (Q88 A10) which was framed like a painting. Not all tablets we tested allowed for side-loading or rooting for example.
So, which hardware are you happy with?
I am especially curious about low-end cheap Chinese hardware that is stable.
For example:
Personally I don't recommend the Nexus 7 tablets: they discharge faster than they can recharge, so running them in an exhibit or other installation is a bad idea.

Hello. I feel like I'm being stupid, but I can't find the Network library. I tried looking for it everywhere on the internet and then I also thought, that it is already built in Processing and I tried importing it inside my code. Please, where is the network library?