Hi! I need some help, please! I'm making an Android app where I want the user to select an image from the gallery to load into the app, I've seen the method selectInput() but it's only working in Java mode for me, not in Android. When trying it in Android mode it gives me this error: The method selectInput(String, String) is undefined for the type "nameOfTheSketch"
And says that the Compile Failed.
How to select an image from Android device
Open and save an image in Android Mode and share it on the net
Hi guys for a work at University I need to develop an Android App that open an image in the gallery, apply some filters, and then save image in the gallery in a new folder (better is the image can be shared on facebook/instagram using android built-in sharing api).
Do you know how to do this? I am not new in Processing and I developed a couple of very tiny apps on Eclipse, so I don't have problems using Eclipse, but I don't know how to do this (I am still learning Processing for Android with Eclipse compiler, and I know very little of Android SDK :( )
Thanks a lot to everyone
0255 - The method onCreate(Bundle) is undefined for the type PApplet
Hiya
I recently installed 0255 so I can play with cardboard which is working and fun... Thanks!
but while I found I can use surface.getActivity()... I can't find a fix for the onCreate(bundle) thing.
// keep screen on import android.os.Bundle; import android.view.WindowManager; void onCreate(Bundle bundle) { super.onCreate(bundle); getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
also needed for Ketai bluetooth
Blur effect filter doesn't work
Hi,
I'm trying to blur the window with filter(BLUR, 12);, but when I upload it to my phone, it just displays a black screen... Is there any way to blur the screen in Android Mode ?
Processing Couldn't Detect My Android Phone
I've installed the android tool in my processing, selected the android SDK API 4.2.2 (17), turned on USB debugging on my phone, and connected my phone to my computer. But if i click Android Menu -> Select device , there's a "no connected devices" text. What should I do?
Video in Android Mode
Hello I am trying to make a project and the first hurdle is making it sense when a viewer is present and play the video/pause video when viewer leaves. I have searched extensively through the forums and other parts of the net and I can't find any code new enough that it is working for me. I am running Processing 3 and I am currently building onto a Samsung Galaxy Tab 3 running 4.4.2. My instincts say that this will be too slow and I will need to figure out how to do it in Java/Eclipse for speed sake, but I wanted to try this first.
Does anyone have any code for efficient video playback that is working for them in Processing 3 Android mode?
Thanks!
Android mode doesn't know any function/variable
Anyone know what I did wrong/how to fix these errors? I think there is not imported library processing.. I tried inport processing.*; But it didn't help.
Screenshot:

saveJSONObject ERROR!!
In the java mode the code work when I use Android mode it don't work anymore,it only crash the app how can I make it work that.
JSONObject data;
int score=2;
int record;
void setup() { data = loadJSONObject("data.json");}
void draw () {
record = data.getInt("record");
record=score;
data.setInt("record", record);
saveJSONObject(data, "data/data.json");}
SQL LoadStrings Error
I am trying to use load strings to get some information from my website which has ssl encryption. Except I am thrown an exception when I try to do this.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
If anyone knows how to fix this it would be appreciated. I am also trying to do this for APDE so a solution for it as well be good if possible.
Thanks
Adding to the manifest and recompiling doesn't accept the changes
Hi all! I am currently building out an app for android, and it requires some tweaking on the manifest doc to enable some functionality. However, after I have compiled the app, I have opened up the xml file and made the changes required but when I recompile it creates a new version of the app in a new directory without the changes.
I am thinking that perhaps it could require exporting as an android project, then compiling with ant - but this only generates an empty bin dir.
Any pointers on how to proceed? thanks!
android usb serial lib crashing app
Hi all! Another day, another question - I am building an app that takes the content of sms and pushes it through to an arduino using the android usb serial lib here:
https://github.com/inventit/processing-android-serial
I am running the app on a pixel xl running nougat 7.1.1, and using the usb otg adapter to connect to an arduino uno. I have modified the manifest xml, and added in the device filter xml (ensuring that it includes the uno device id) but when I run the app it throws this error:
"Processing-Android USB Serial ERROR
Port: null Check the following items: 1. Make sure AndroidManifest.xml contains use-feature tag for android.hardware.usb.host 2. USB Serial is connected to the device"
I have checked that the manifest has the use-feature tag, and the usb cable is plugged in and supplying power to the arduino, but if I plug the cable in before starting the app, or plugging it in after the app has started, or even plugging it in before, then unplugging it when the error shows and replugging - it always throws the same error and closes when I close the dialogue.
I was wondering whether the android manifest requirements have changed since the release of nougat but that doesn't seem to be the case. Does anyone have any ideas why this could be causing a problem?
Send notification function
Can anyone send me notification function for processing? Or if there isn't any library for that, can anyone make a function for me please? I tried to do it myself, but i failed :(
Manifest merger and Android project export for Cardboard
Hi, I am trying the beta release of the Android mode and want to highlight this error when exporting a project containing the Cardboard module. Since there are three modules generated by the Android Studio converter when importing the project, it needs to merge manifests, and thus it needs one single android:label and android:icon .
After conversion, I had to change the tag to
<application
android:debuggable="true"
android:icon="@drawable/icon"
android:label="Cube"
tools:replace="android:icon, android:label">
and of course, to do so, I also changed the manifest tag to:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="processing.test.cube"
android:versionCode="1"
android:versionName="1.0">
But this could be generated automatically when exporting Android projects in Processing, couldn't it?
Cheers. Yohan.
Screen Brightness
I'm trying to set screen brightness maximum but i couldn't do it somehow.
Here is my code:
` void setup(){ fullScreen(JAVA2D);
WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes(); lp.screenBrightness = 1; getActivity().getWindow().setAttributes(lp); } `
void draw(){ //somestuff }
When i run it, application crashes on the phone. Then in the console;
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:8128) at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1220) at android.view.View.requestLayout(View.java:20085) at android.view.View.setLayoutParams(View.java:13597) at android.view.WindowManagerGlobal.updateViewLayout(WindowManagerGlobal.java:360) at android.view.WindowManagerImpl.updateViewLayout(WindowManagerImpl.java:97) at android.app.Activity.onWindowAttributesChanged(Activity.java:2858) at android.view.Window.dispatchWindowAttributesChanged(Window.java:894) at com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged(PhoneWindow.java:5057) at android.view.Window.setAttributes(Window.java:925) at processing.test.sketch_161217b.sketch_161217b.setup(sketch_161217b.java:48) 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:818)
Android mode doesn't recognize orientation and fullScreen functions
I made my code in normal java mode first and now I'm migrating to Android mode, but for some reason it can't recognise the orientation and fullScreen functions saying "it does not exist"
size of sketch in an processing 3 android app
Hi,
I'm trying to port a processing 2 android application to a processing 3 android application using android studio. So far I've been able to launch the app on my phone. However, the original sketch only appears within a 100 x 100 pixel square in the center of the screen (it should cover the whole screen).
This is what I got so far.
res/layout/activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
tools:context=".MainActivity">
<FrameLayout android:id="@+id/mysketch"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="0dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
java/test/mysketch/MainActivity.java:
package test.mysketch;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.view.WindowManager;
public class MainActivity extends Activity {
private static final String TAG = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
FragmentManager fragmentManager = getFragmentManager();
Fragment fragment = new VideOSC();
fragmentManager.beginTransaction()
.replace(R.id.videosc, fragment)
.commit();
}
}
java/test/mysketch/MySketch.java:
package test.mysketch;
public class MySketch extends Activity {
static int width, height;
private static String TAG = "MySketch";
public void setup() {
View view = this.getView();
if (view != null) {
width = view.getWidth();
height = view.getHeight();
}
noStroke();
fill(0);
}
public void draw() {
// posted result seems to correctly reflect available screen width/height,
// yet, sketch appears to be 100 x 100 pixels big
Log.d(TAG, "dimensions: " + width + ", " + height);
}
}
Any clues?
Thanks very much,
Stefan
Fullscreen resolution
Hello, I have just installed the AndroidMode and wanted to try porting some programs I made in Java mode. There are a few that process all pixels on screen, which is why I don't use fullscreen resolution on my Desktop. Is there a way I can set a lower resolution on my phone but still using fullscreen? Passing numbers smaller than 'displayWidth' and 'displayHeight' to the size() method will draw a smaller canvas :/
This example program runs at 2FPS on my Samsung Galaxy S7:
new installation -- error running in "Android Mode" The keytool seems to be missing
OS Platform: Debian Jessie
I am just starting a tutorial on processing.
When running the first very simple program I get an error at the key-generating phase:
program "/home/ibanja/dev/android/processing/processing-3.2.3/java/bin/keytool": error=2, No such file or directory
The code is cut and pasted from the tutorial and runs fine in "Java mode" so I don't think that is the problem.
The program code is:
void setup()
{
}
void draw()
{
ellipse(mouseX, mouseY, mouseX-pmouseX, mouseY-pmouseY);
}
I have tried running the following command with no success:
$ keytool -genkey -alias AndroidDebugKey -keyalg RSA -dname "CN=Android Debug,O=Android,C=US" -validity 10950 -keypass android -keystore /home/ibanja/.android/debug.keystore -storepass android
Exception in thread "main" java.lang.ExceptionInInitializerError
at javax.crypto.SecretKeyFactory.nextSpi(java.base@9-ea/SecretKeyFactory.java:303)
at javax.crypto.SecretKeyFactory.<init>(java.base@9-ea/SecretKeyFactory.java:121)
at javax.crypto.SecretKeyFactory.getInstance(java.base@9-ea/SecretKeyFactory.java:168)
at sun.security.pkcs12.PKCS12KeyStore.getPBEKey(java.base@9-ea/PKCS12KeyStore.java:823)
at sun.security.pkcs12.PKCS12KeyStore.encryptPrivateKey(java.base@9-ea/PKCS12KeyStore.java:892)
at sun.security.pkcs12.PKCS12KeyStore.setKeyEntry(java.base@9-ea/PKCS12KeyStore.java:600)
at sun.security.pkcs12.PKCS12KeyStore.engineSetKeyEntry(java.base@9-ea/PKCS12KeyStore.java:560)
at sun.security.util.KeyStoreDelegator.engineSetKeyEntry(java.base@9-ea/KeyStoreDelegator.java:111)
at java.security.KeyStore.setKeyEntry(java.base@9-ea/KeyStore.java:1162)
at sun.security.tools.keytool.Main.doGenKeyPair(java.base@9-ea/Main.java:1729)
at sun.security.tools.keytool.Main.doCommands(java.base@9-ea/Main.java:1054)
at sun.security.tools.keytool.Main.run(java.base@9-ea/Main.java:375)
at sun.security.tools.keytool.Main.main(java.base@9-ea/Main.java:368)
Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
at javax.crypto.JceSecurity.<clinit>(java.base@9-ea/JceSecurity.java:91)
... 13 more
Caused by: java.lang.NullPointerException
at sun.nio.fs.UnixPath.normalizeAndCheck(java.base@9-ea/UnixPath.java:75)
at sun.nio.fs.UnixPath.<init>(java.base@9-ea/UnixPath.java:69)
at sun.nio.fs.UnixFileSystem.getPath(java.base@9-ea/UnixFileSystem.java:280)
at java.nio.file.Paths.get(java.base@9-ea/Paths.java:84)
at javax.crypto.JceSecurity.setupJurisdictionPolicies(java.base@9-ea/JceSecurity.java:254)
at javax.crypto.JceSecurity.access$000(java.base@9-ea/JceSecurity.java:49)
at javax.crypto.JceSecurity$1.run(java.base@9-ea/JceSecurity.java:82)
at javax.crypto.JceSecurity$1.run(java.base@9-ea/JceSecurity.java:79)
at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)
at javax.crypto.JceSecurity.<clinit>(java.base@9-ea/JceSecurity.java:78)
... 13 more
Is there a way to generate the key or install the keytool into /home/ibanja/dev/android/processing/processing-3.2.3/java/bin/? Is that even the problem?
Can't run sketch on Android Phone
Hi, I'm trying to get Android Mode to work. I have two phones handy to try. 'A' version = 2.3.3 'B' = 4.4.2. Both have 'unknown sources' and 'usb debugging' switched on.
(I've been through the onRequestPermissionsResult issue as in several threads, downloaded AndroidMode 0250 and replaced.)
Sketch is minimal: void setup(){size(80,80);} void draw(){}
With A I want to select SDK for 2.3.3 but it's not offered on the IDE, Android, Select Target SDK. That shows from 7.1.1 down to 3.0. The SDK Manager is showing those and 2.3.3. + 3 more installed. How can I select 2.3.3 ?
With B (selected 4.4.2) the sketch builds, Console title bar says "Running sketch on device", console says "debug:", nothing visible on phone.
How to implement Processing Sketch without PFragment ?
Hello everybody !
Since P3, it seems that the object PFragment is not available :
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import processing.core.*;
import processing.android.P;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.class_main);
FragmentManager fragmentManager = getFragmentManager();
PApplet sketch = new Sketch();
PFragment fragment = new PFragment();
fragment.setSketch(sketch);
fragmentManager.beginTransaction().replace(R.id.container, fragment).commit();
}
}
How can I do to insert my Processing Sketch in my Android Studio project ?
Thank you, Regards,
Arthur