Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all 941 articles
Browse latest View live

Cardboard example code doesn't work on a device

$
0
0

I've tried a cardboard example code from android.processing.org. Compiling process was ok, but when the sketch launched on a device it didn't work. TIA

swann


Device Samsung Galaxy Tab E 8.0 (Android 6.0.1)

Processing version 3.3.2

Android mode Version pre 4.0 beta7 (260)

Operating system OSX 10.11.6

Target APIs you have tried (Installed through the Android SDK manager and visible in the Processing IDE Android mode) Android SDK version. Did you install it yourself or using the automatic installation offered by the Processing IDE android mode? manual installation(Android Studio / update SDK-tools to 25.2.5) SDK path : ~/Library/android/sdk

Have you run Android apps in Processing before? In any other SDK like Eclipse or Android Studio (AS)? Yes in Processing

Is this your first time? Did you enabled the developer mode in your device? Yes

did you check the following website as a reference: http://android.processing.org/install.html Did you try any other set of instructions? Which ones? Can you provide your link? Yes

Are you running your app in an actual device or through an emulator? (NOTE: It is strongly recommended to do it on an actual device) Yes

Have you activated the debug mode on your phone + what is your phone OS ? ) + give us more error code (not only the first 2 lines) Yes


Processing code:

import processing.vr.*; import processing.cardboard.*;

void setup() { fullScreen(PCardboard.STEREO); }

void draw() { }


error code:

FATAL EXCEPTION: main Process: processing.test.sketch_170501a, PID: 13617 java.lang.RuntimeException: Unable to start activity ComponentInfo{processing.test.sketch_170501a/processing.test.sketch_170501a.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getAbsolutePath()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3319) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) at android.app.ActivityThread.access$1100(ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7406) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getAbsolutePath()' on a null object reference at processing.core.PApplet.initSurface(Unknown Source) at processing.core.PApplet.initSurface(Unknown Source) at processing.vr.PVR.setSketch(Unknown Source) at processing.test.sketch_170501a.MainActivity.onCreate(MainActivity.java:14) at android.app.Activity.performCreate(Activity.java:6904) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266) ... 9 more


Speech to Text & Voice Recognition by Android mode(at Processing Tool)

I'm confused on Android install procedure

$
0
0

To install Processing for Android the procedure sates to install Processing first. Do I install processing into my Android device, a Kindle Fire, first then install Android? Or I've already installed processing on my computer, do I now install Android on to my computer then transfer the sketch to the Android device?

Second question, has any one use this on a Kindle Fire?

Thanks John

How to use Shared Preferences in Processing android

$
0
0

Hello How do i use share preferences to store an integer in processing for android. I don't have any libraries installed and when i say import android.content.SharedPreferences it gives me an error. Is there a function that is called when the program quits so I can update the stored integer in there? And how would i do that? And is there also a function that is called when the program starts? How can i update a variable from the value stored in the shared preferences. Thank you very much. Dan4o

Android file selector?

$
0
0

I've been trying all the solutions I can find on the forums, but I can't get any of them to work. I just need a simple file selector, something that will return a file path that I can load as an image or sound clip into Processing.

Thanks for any help.

How to make watch-face app and other processing app communicate? (on bluetooth paired smartwatch).

$
0
0

I'm not even close to app developer

but with the help of android mode and using simple udp libraries and controlp5 library,

I was able to connect the app to the self made IOT objects and control them!

.

In the pre-release version for android mode, I found something called watch face,

I tried using it, and luckily my sketch showed up in the smart watch!

.

I tried uploading the same code (basically clickable button to send data via udp communication)

but of course it didn't work.

(watch face app data seems to be self contained inside the watch.)

.

If i give permission to the app in smartphone,

It is possible to make sketch get inputs from or give outputs to other.

.

still, I can't figure out how to send data from watchface app or make watchface app react on other inputs.

since the watch is paired to the smartphone via bluetooth,

if there's a way to let "smartwatch (watchface app) - smartphone (android mode app)"

to communicate with each other, I think it will do the work.

(or perhaps a way to allow watchface app to burrow smartphone's wifi resource? )

.

Any similar attempts or comments are welcomed

thank you.

sorry for the bad english,

(not native speaker...)

heart rate sensor

$
0
0

hell-o world

i tried example in ketai library for measure heart rate value. i gave also body sensor permission, but it's not working.

what should i do..?

import ketai.sensors.*;

KetaiSensor sensor;

float heartrate = 0; boolean isStepDetectorAvailable = true ; boolean isStepCounterAvailable = true; boolean SENSOR_STATUS_UNRELIABLE=false; boolean SENSOR_STATUS_NO_CONTACT=false; void setup() { fullScreen(); sensor = new KetaiSensor(this); sensor.start(); sensor.list(); orientation(PORTRAIT); textAlign(CENTER, CENTER); textSize(30); sensor.enableHeartRateSensor();

} void draw(){ background(#7F0000); text(heartrate,width/2,height/2);

} public void mousePressed() { if (sensor.isStarted())
sensor.stop();
else{
sensor.start();
sensor.enableHeartRateSensor(); println("Sensor isStoped: " + sensor.isStarted()); }

} void onHeartRateEvent(float r){ heartrate= floor(r);
}

How to send email with attachment in background---Android Mode.

$
0
0

Hello

Question 1 is: how to send email with attachment in background, aka, without user interference. e.g there is a button on the app, user taps the button, app send stuff immediately, without open build in email app.

I have tried https://forum.processing.org/two/discussion/17064/how-to-send-an-email-via-processing, it worked, but this is in Java mode, what I want is something like this but in Android mode. A search leads me to this, http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a The question is ,how to "convert" the above code in Processing. As I know nothing about coding for Android. What I thought about P5 Android Mode was, I worte some code in Java mode, tested ok, then, switch to Android mode, everything should work just fine. Unfortunatelly, this is not the case. It appears, if I want to do app for Android, I have to learn stuff specifically for Android.

Question 2: Is there any profesional who can give me some advice as for if I want to do app for Android in Processing (I only know processing, and I love it's simplicty, easy to use)which book or online resources I should check? Please be noted, as for coding, till now, I am only a beginner of Processing.

Thank you for your help and reply.


Sketch compiles on phone but crashes before it starts

$
0
0

Basically what i said on the title, i downloaded processing 3.3, android mode 4 (because all i care about is cardboard, so please don't tell me to use another version unless there's a way to do cardboard there) and autodownloaded the SDK because i couldn't make it work manually no matter what i tried. Processing opens up, detects my phone, i paste the getting started example, compiles on my phone, no problems. But then i open the app, it stays white for like 5 seconds, and then crashes with the typical "app has stopped" alert.

FYI i have a samsung s3 mini (android 4.1, api 16). I'm pretty sure it's a problem with the API. Processing auto-downloads api 25 and never cares to ask about downloading other versions, i manually did with SDK manager but there's no place to set the api. BTW i once managed to run an app i made in processing (normal java mode) compiling the .pde directly on the phone with some "AIDE" app. It was a lot of trouble tho. And i can make and run apps from Unity no problem. So it's not a problem with USB driver either.

So.. any ideas? anyone got anything running on api 16? if so, how?

APKs are not installed

$
0
0

Hi! I'm using processing at school for teaching beginners on programming. All has been fine for 3 years now, but last week, when the students installed AndroidMode for the first time, the resulting APKs (very very simple programs) could not be installed. We compiled with API 4.0 which is good for all devices. I installed Processing 3.3.3 on my own computer with AndroidMode 3.0.2 - same result, APK not installed (installation on Samsung Smartphone looks good first, but instead of "successfully installed" I get "App was not installed" (in German). Not only my phone, also all (!) students phones. Spent 2 nights on that topic, would like to continue work at school with processing. Any hints what to do would really really be appreciated!

Pass data from USB arduino to sketch

$
0
0

I'm using Processing 3.0 in android mode + Android Studio to develop my app. My app reads serial data from an Arduino over USB and the sketch displays the data. I had this working ok but it was too slow and jumpy so I changed the Arduino program to use the Multiwii Serial Protocol. That protocol works great if I use regular old Android and Views. When I try to go back to Processing and send the serial data from MainActivity to Papplet sketch, I get Null pointer errors. The Multiwii Serial protocol works great until I try to use Processing Android mode. I don't know what to do to get the received byte[] data into the sketch. I know the MainActivity receives over the USB when I get the toasts saying so.

How should I try to do this?

apwidgets media player not working?

$
0
0

Hi, I downloaded the apwidgets library so I can play sounds on my android phone, but it isn't quite working. I can import the library and declare a new APMediaPlayer variable, but if I so much as try to initialize it, it crashes as soon as it launches and I get this error:

FATAL EXCEPTION: Animation Thread
Process: processing.test.android_sound_test, PID: 5490
java.lang.NoSuchMethodError: No virtual method getAssets()Landroid/content/res/AssetManager; in class Lprocessing/core/PApplet; or its super classes (declaration of 'processing.core.PApplet' appears in /data/app/processing.test.android_sound_test-1/base.apk)
    at apwidgets.APMediaPlayer.setMediaFile(APMediaPlayer.java:81)
    at processing.test.android_sound_test.android_sound_test.setup(android_sound_test.java:28)
    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:762)

Here is my code, if it helps. It's basically the example in the wiki:

import apwidgets.*;
APMediaPlayer player;

void setup () {
  fullScreen ();

  player = new APMediaPlayer(this); //create new APMediaPlayer
  player.setMediaFile("Hope you have a good day.mp3"); //set the file (files are in data folder)
  player.setLooping(true); //restart playback end reached
  player.setVolume(1.0, 1.0); //Set left and right volumes. Range is from 0.0 to 1.0
  player.start(); //start play back
}

void draw () {
  background (0);
}

public void onDestroy() {
  super.onDestroy(); //call onDestroy
  if (player != null) { //must be checked because or else crash when return from landscape mode
    player.release(); //release the player
  }
}

Current state of video library support

$
0
0

Anyone have any knowledge on video support for Android mode?

This library seems to be the thing:

https://github.com/omerjerk/processing-video-android

But it hasn't been maintained since 2015. Attempted to use it and having difficulty getting Processing IDE to see it as a library. (so maybe someone knows how to do that? I'm a newbie to Android mode).

Also, confusingly, in Android mode (4.x pre-release) when adding libraries via the "Sketch" dropdown menu there are two "native" options the "vr" lib, which is for Cardboard support (and works great!) and the other is "video" suggesting there is now a native video lib for Android mode.

Any help would be greatly appreciated.

Android emulator - Error message.

$
0
0

emulator

error message

Processing Android Mode: Try to operate the emulator.

Do you know what the problem is?

I want to apply MYSQL code to my mobile phone. (at Processing)

$
0
0

I have one question. I want to apply MYSQL code to my mobile phone.

However, ANDROID seems to have an error. (at import de.bezier.data.sql.*;.)

Do you have any solutions?

Is mySQL control possible through processing (in Android mode)?

Answers I'll wait.


noLoop function

$
0
0

I have a problem i would like to stop the execution of void draw() but on android processing the function noLoop() don't work and i want an equivalent to finish my program. Thank for your help!

Building Android Project Fails

$
0
0

Hey there, Im just getting into Processing and tried to run the sketch from the tutorial. Letting the sdk install autmatically by Processing didnt work for me so I downloaded all sdks with android studio down to 14(android 4.0) and edited the path in the preferences.txt file. When I now try letting the project being build I receive this:

[mkdir] Created dir: C:\Users\Marvin\AppData\Local\Temp\android1390691181088263247sketch\bin [echo] org.eclipse.jdt.core.JDTCompilerAdapter

BUILD FAILED C:\Users\Marvin\AppData\Local\Temp\android1390691181088263247sketch\build.xml:81: Cannot find C:\Users\Marvin\AppData\Local\Android\sdk\tools\ant\build.xml imported from C:\Users\Marvin\AppData\Local\Temp\android1390691181088263247sketch\build.xml

Total time: 0 seconds

I installed the most recent official version of processing and Android mode. Also Im on Win10, if that helps:P Thanks for your advice

Processing won't export signed package

$
0
0

So I needed the apk from my processing sketch (Andriod mode) so I went ahead and exported the signed package but now it just says "Exporting signed package..." so how would I solve this?

Ketai Camera and Zxing Library, I need help. :)

$
0
0

I want to scan QRcodes using the Ketai Android support library, As we all know it has KetaiCamera which utilizes your mobile phones camera and actually reads the images out of it. I want to integrate Zebra Crossing to scan qrcodes for image processing projects.

I recently found this code in GitHub and tried it on my system: https://gist.github.com/darkwave/43352f775e6f767a11cb

After running this sketch I had problems with: ->PlanarYUVLuminanceSource ->BinaryBitmap bitmap

After doing some research I found that there is a java file that you can add to your sketch inside the Zxing Library C:\Users######\Documents\Processing\libraries\zxing\core\src\main\java\com\google\zxing "PlanarYUVLuminanceSource.java"

I tried adding that to my sketch in hopes of utilizing this java code to this old sketch i found on github but it has given me another error and now i'm stuck.

java.io.IOException: The filename, directory name, or volume label syntax is incorrect at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createTempFile(File.java:2024) at processing.app.Util.saveFile(Util.java:172) at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:532) at processing.mode.android.AndroidBuild.createProject(AndroidBuild.java:160) at processing.mode.android.AndroidBuild.build(AndroidBuild.java:94) at processing.mode.android.AndroidMode.handleRunDevice(AndroidMode.java:295) at processing.mode.android.AndroidEditor$16.run(AndroidEditor.java:553) processing.app.SketchException: Problem moving PlanarYUVLuminanceSource.java to the build folder at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:538) at processing.mode.android.AndroidBuild.createProject(AndroidBuild.java:160) at processing.mode.android.AndroidBuild.build(AndroidBuild.java:94) at processing.mode.android.AndroidMode.handleRunDevice(AndroidMode.java:295) at processing.mode.android.AndroidEditor$16.run(AndroidEditor.java:553)

Anyway, Any ideas?

Ketai camera methods?

$
0
0

Hey guys,

Still working with the KetaiCamera library.

I want to be able to change other camera settings, like image rotation and front/back camera, but this reference page is a bit confusing and doesn't give many methods not found in the example sketch, CameraGettingStarted.

Has anyone else worked with the camera like this?

Viewing all 941 articles
Browse latest View live