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

Resolution

$
0
0

Hello everyone, I did not understand very well and would be grateful if someone could explain. If I create an app for a 5-inch screen and use that program on a 4-inch screen, does the program reset the new resolution automatically or for each screen do I have to make a different app? Thanks in advance.


Errors after modifying my app in Android Studio

$
0
0

Screenshot (15) Can anyone please help me out with solving this errors!! I have codded this app in processing. Then i applied layouts to app in Android Studio.

This the Error message:

Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:

Error:Execution failed for task ':app:mergeDebugResources'.

Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:

How can i login a website using Processing and Java

$
0
0

Hi.

My goal is to build an Android App that login itself at my university members area and grabs personal infos.

Now, i know that probably the website uses Shibboleth auth system. Unfortunately, i don't know how to start....

How can i do it using Java ?

Is it possible to let processing to communicate with Android WallpaperService.Engine?

$
0
0

Is it possible to let processing to communicate with Android WallpaperService.Engine?

(or "interact / integrate" sorry, I just don't know the right word. English ist not my mother tongue)

Thanks

Live Wallpaper not functioning correctly after rotation

$
0
0

Hey, After fiddling around for a while I've created a live wallpaper in the new beta mode, and I'm quite pleased with the result. However, if I enable rotation in my launcher (Google Now) and switch between horizontal en vertical orientation a few times, the animated elements are not alligned correctly anymore, the background however is still visible. If it helps, I am testing on a S7 Edge.

Thanks in advance!

Generate Waveform in Processing for Android

$
0
0

Hi, here is a code to generate sinewave in android mode

import android.media.*;
import android.content.res.*;

PlaySound sineWave = new PlaySound();
boolean on=false;

void setup()
{
  size(displayWidth, displayHeight);
  sineWave.genTone(340);   //frenquency
}

void draw() {
  if (mousePressed) {
    delay(100);
    if (on) {
      on=false;
      sineWave.playSound(false);
      print("off");
    }
    else {
      on=true;
      sineWave.playSound(true);
      print("on");
    }
  }
}

And the Class Object :

public class PlaySound {
  private final int sampleRate = 8000;
  private final int numSamples = sampleRate;
  private final double samples[] = new double[numSamples];
  private final byte generatedSnd[] = new byte[2*(numSamples)];

  final AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC,
  sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO,
  AudioFormat.ENCODING_PCM_16BIT, numSamples,
  AudioTrack.MODE_STATIC);

  void genTone(double freqOfTone) {
    // fill out the array

    for (int i = 0; i < numSamples; ++i) {
      samples[i] = Math.sin(2 * Math.PI * i / (sampleRate/freqOfTone));
    }
    // convert to 16 bit pcm sound array
    // assumes the sample buffer is normalised.
    int idx = 0;
    for (double dVal : samples) {
      // scale to maximum amplitude
      short val = (short) ((dVal * 32767));
      // in 16 bit wav PCM, first byte is the low order byte
      generatedSnd[idx++] = (byte) (val & 0x00ff);
      generatedSnd[idx++] = (byte) ((val & 0xff00) >>> 8);
    }
    audioTrack.write(generatedSnd, 0, numSamples*2);
    audioTrack.setLoopPoints(0, numSamples/2, -1);
  }

  void playSound(boolean on) {
    if (on) {

      audioTrack.play();
    }
    else {
      audioTrack.pause();
    }
  }
}

Unable to build

$
0
0

Hi all,

When trying out android mode in processing I get the following error:

C:\Users\Matt\AppData\Local\Temp\android3005389885981532069sketch\build.xml:81: Cannot find D:\Tools\Android\sdk\tools\ant\build.xml imported from C:\Users\Matt\AppData\Local\Temp\android3005389885981532069sketch\build.xml

I have the SDK installed to d:\Tools\Android\SDK however within the tools folder there is no ant folder. I have no idea what ant is or why ti would be missing? I have Android Studio installed on the same machine and this is able to build apps without any issue, can anyone help?

Thanks,

Matt

#RoastMyCode revolution of function 3D visualization


App Permissions Not Working Correctly

$
0
0

Hello, I am having an issue regarding app permissions. My app requires one permission which is "write_external_storage." When I build it and run it locally on my phone it works as expected and I can see in the android application manager that it is requesting one permission. However, (and excuse me if this is the wrong place to ask this question) I have uploaded it to the Google Play store and when I download it from there are run it on my phone the app does not ask for any permissions. As a result I am not able to use the write_external_storage function that I need.

I have decompiled the .apk and I can see that in the manifest file it says:

also, it looks like it is targeting level 21 if that is relevant to the discussion:

android:targetSdkVersion="21" />

Thanks in advance!

Does the PVector.add() - Method not work in the Android Mode?

$
0
0

Hello Processing community,

when I'm trying to run this code in Android mode, i get a error message:

PVector Vec;
void setup(){
  Vec = new PVector(0, 0);
}

void draw(){
  Vec.add(1, 1);
}

In the Java mode it works just fine. Is is a bug or do i have to redownload Processing? I have already redownloaded the Android mode. I know that i could just use Vec.x += 1; Vec.y += 1;, but I thought I would tell you guys, because the problem isn't listed here: android.processing.org/reference/gone.html

Sorry for my bad English and thanks for the answers

How to get a continuous image of the screen?

$
0
0

Hi, I'd like to write an app that involves continuously scanning the screen of an Android device into a PImage variable. How do I do this in real time?

Thanks in advance for your response(s).
Les

USB communication Arduino Pro Micro / Leonardo and Android

Android App only 100x100.

$
0
0

Hey, I'm having a problem where my standard canvas size (without size() method) is only 100x100, and I also can't change it with size(). On a new sketch with size() and background() set it works, but not with my app. I also tried to comment out basically everything. Didn't have this problem before. I think it started when I updated processing and android-mode. Can someone help? cheers

Can I override Android methods like onPause(), onResume() in Processing?

$
0
0

Hi! I want to know that can I override Android methods like onPause(), onResume() in Processing? I also want to override "back" key. Because by default if I press back key it closes the sketch. I dont want that to happend. Thanks in advance :)

How to make an Android Processing sketch fragment semi-transparent

$
0
0

Hi all!

I'm happily using Processing from the Android IDE, allowing me to add certain critical functionality through Android Java directly. For the project I'm now working on, I want to overlay all kinds of nice Processing sketches, in a "virtual reality" way, over a camera view. Because displaying the camera view and doing the required detection is a bit heavy, I'll be doing this with OpenCV instead of Processing. My idea was to then simply overlay the Processing sketch fragment over the OpenCV fragment, thus allowing the cool 3D stuff to be easily programmed in Processing, while the more intensive camera stuff is done with OpenCV.

However, although I've managed to make simple Android fragments semi-transparent, I can't seem to be able to make the Processing sketch fragment semi-transparent. Maybe this is because it's neccessary to go all the way down to the SurfaceView involved and make it semi-transparent or something?

I'd be very much obliged if someone could help me out :)

The code is generally as follows:

The main layout file:

<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" ... > <FrameLayout android:id="@+id/bg_frame" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#cc0000" ... > <FrameLayout android:id="@+id/fg_frame" android:layout_width="fill_parent" android:layout_height="fill_parent" ... > </RelativeLayout>

The Processing sketch:

public class MySketch extends PApplet { ... public void draw() { background(color(255, 50)); // semi-transparent ... } ... }

The activity:

public class MainActivity extends Activity { ... protected void onCreate(Bundle savedInstanceState) { ... getFragmentManager().beginTransaction() .add(R.id.fg_frame, new MySketch()) .commit(); ... } ... }

I have tried (as you can see above) using Processing's background color background(color(255, 50)).

Also, I've tried setting android:background="@android:color/transparent" as well as android:alpha="0.5f" in the fb_frame frame layout.


Help with Free App for Blind and Visually Impaired

$
0
0

Hi,

I have written a simple Android app as part of an effort to expand the services of e-NABLE to include help for the blind and visually impaired. The app emits a tone that varies in frequency according to the brightness of the pixel touched. The technique is nothing new and has limited utility but it's a good start in the right direction. You can find it on GitHub by following this link:

https://github.com/LesHall/blind-sight

At this time it works on the front cam image only. If we could take a screenshot of the entire Android display and determine the coordinates of the operator's finger on that display, then we could "e-NABLE" the operation of cell phones for blind and visually impaired people. I'm not sure if this is out there, but if it isn't then this could be of great benefit for those who need it.

Further developments may include time-spectral mapping of FFT's of the fingerprint or image or some other encoding that could be learned by the operator to sense the phone's screen or part of it. Also if such a thing can be done on a cell phone, then it is a simple matter to put the back cam on and point it around like a window on the world. You can imagine how powerful that could be for many people.

Thanks in advance for whatever help you can offer.
Les

Running sketches on my smartphone does not work anymore

$
0
0

Hello Processing community, everytime I launch a sketch on my smartphone the sketch immediately stops and the message "[sketch name] stopped" pops up (on my smartphone, Samsung Galaxy S6, Android 6.0.1). A few days ago I didn't have this problem. I already tried: - restarting both my smartphone and desktop pc - reinstalling both Processing and the Android Mode (and the Android SDK) - using another account on my desktop pc It doesn't matter what's inside the sketch, even an empty program or an Example by Processing don't work. Everything works fine on the Java Mode. Please help me

How can i use scoreboard of Google play ? Can anyone give example about it ?

$
0
0

How can i use scoreboard of Google play ? Can anyone give example about it ?

Issues running on emulator and device

$
0
0

Hi, I'm very new to processing and I'm trying to get a sketch to run on the emulator or device for the first time. I've spent four days scrolling through forums but nothing seems to have fixed the issue. The emulator will load up completely but when I run my sketch on it, it says "could not create a virtual device for the emulator". If I try to run it on my device it say's that it lost connection to the device. The android API is set to 6.0(23) on the target SKD. The SKD manager is downloaded and have the relevant APIs and tools downloaded. My AVD is set as Processing-0217 and will load up fine but won't load a sketch. In order to check that this wasn't my novice coding affecting things, I'm trying to run a simple black background with a white box so I don't think this is an error with the coding. No error message comes up but I do get 14 warnings that i've pasted below. Any ideas on how to fix this?

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

-set-mode-check:

-set-debug-files:

-check-env: Android SDK Tools Revision 25.2.5 Installed at C:\Users\KAT\Documents\Processing\modes\AndroidMode\sdk

-setup: [echo] Project Name: sketch_170326a Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup: Using latest Build Tools: 26.0.0 rc1 [echo] Resolving Build Target for sketch_170326a... Project Target: Android 6.0 API level: 23 [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res [mkdir] Created dir: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\rsObj [mkdir] Created dir: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\rsLibs [mkdir] Created dir: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\gen [mkdir] Created dir: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\classes [mkdir] Created dir: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\dexedLibs [echo] ---------- [echo] Resolving Dependencies for sketch_170326a... Library dependencies: No Libraries


 [echo] ----------
 [echo] Building Libraries with 'debug'...

[subant] No sub-builds to iterate on

-code-gen: Merging AndroidManifest files into one. Manifest merger disabled. Using project manifest only. [echo] Handling aidl files... No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [echo] ---------- [echo] Handling Resources... Generating resource IDs... [echo] ---------- [echo] Handling BuildConfig class... Generating BuildConfig class.

-pre-compile:

-compile:

[javac] Compiling 4 source files to C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\classes

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\MainActivity.java (at line 11) import android.support.v4.content.ContextCompat; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The import android.support.v4.content.ContextCompat is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\MainActivity.java (at line 15) import android.Manifest; ^^^^^^^^^^^^^^^^

The import android.Manifest is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\MainActivity.java (at line 49) int check; ^^^^^

The value of the local variable check is not used


  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 4) import processing.data.*; ^^^^^^^^^^^^^^^

The import processing.data is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 5) import processing.event.*; ^^^^^^^^^^^^^^^^

The import processing.event is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 6) import processing.opengl.*; ^^^^^^^^^^^^^^^^^

The import processing.opengl is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 8) import java.util.HashMap; ^^^^^^^^^^^^^^^^^

The import java.util.HashMap is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 9) import java.util.ArrayList; ^^^^^^^^^^^^^^^^^^^

The import java.util.ArrayList is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 10) import java.io.File; ^^^^^^^^^^^^

The import java.io.File is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 11) import java.io.BufferedReader; ^^^^^^^^^^^^^^^^^^^^^^

The import java.io.BufferedReader is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 12) import java.io.PrintWriter; ^^^^^^^^^^^^^^^^^^^

The import java.io.PrintWriter is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 13) import java.io.InputStream; ^^^^^^^^^^^^^^^^^^^

The import java.io.InputStream is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 14) import java.io.OutputStream; ^^^^^^^^^^^^^^^^^^^^

The import java.io.OutputStream is never used

  1. WARNING in C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\src\processing\test\sketch_170326a\sketch_170326a.java (at line 15) import java.io.IOException; ^^^^^^^^^^^^^^^^^^^

The import java.io.IOException is never used

14 problems (14 warnings)

-post-compile:

-obfuscate:

-dex: input: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\classes input: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\libs\android-support-v4.jar input: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\libs\processing-core.jar Pre-Dexing C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\libs\android-support-v4.jar -> android-support-v4-1bcc11c51f82e7fa90181ff9ec342685.jar Pre-Dexing C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\libs\processing-core.jar -> processing-core-e11ed9c58d0bd900949a9fdea907518e.jar Converting compiled files and external libraries into C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\classes.dex... [dx] Merged dex #1 (9 defs/5.8KiB) [dx] Merged dex #2 (1153 defs/1127.0KiB) [dx] Merged dex #3 (171 defs/703.5KiB) [dx] Result is 1333 defs/2250.4KiB. Took 1.4s

-crunch: [crunch] Crunching PNG Files in source dir: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\res [crunch] To destination dir: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res [crunch] Processing image to cache: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\res\drawable-hdpi\icon.png => C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-hdpi\icon.png [crunch] (processed image to cache entry C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-hdpi\icon.png: 52% size of source) [crunch] Processing image to cache: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\res\drawable-ldpi\icon.png => C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-ldpi\icon.png [crunch] (processed image to cache entry C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-ldpi\icon.png: 0% size of source) [crunch] Processing image to cache: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\res\drawable-xhdpi\icon.png => C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-xhdpi\icon.png [crunch] (processed image to cache entry C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-xhdpi\icon.png: 74% size of source) [crunch] Processing image to cache: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\res\drawable-xxhdpi\icon.png => C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-xxhdpi\icon.png [crunch] (processed image to cache entry C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-xxhdpi\icon.png: 89% size of source) [crunch] Processing image to cache: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\res\drawable-xxxhdpi\icon.png => C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-xxxhdpi\icon.png [crunch] (processed image to cache entry C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable-xxxhdpi\icon.png: 89% size of source) [crunch] Processing image to cache: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\res\drawable\icon.png => C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable\icon.png [crunch] (processed image to cache entry C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\res\drawable\icon.png: 84% size of source) [crunch] Crunched 6 PNG files to update cache

-package-resources: Creating full resource package...

-package: Current build type is different than previous build: forced apkbuilder run. Creating sketch_170326a-debug-unaligned.apk and signing it with a debug key...

-post-package:

-do-debug: Running zip align on final apk... [echo] Debug Package: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\sketch_170326a-debug.apk [propertyfile] Creating new property file: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\build.prop [propertyfile] Updating property file: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\build.prop [propertyfile] Updating property file: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\build.prop [propertyfile] Updating property file: C:\Users\KAT\AppData\Local\Temp\android7533559375860661968sketch\bin\build.prop

-post-build:

debug

OSCP5 compatibilty

$
0
0

Are OSCP5 messatges only compatible with OSCP5 messatges ? Is there any libary which allow me to make a tcp client as processing.net.* but in andorid mode? I just want a recieve data send by a arduino launchpad. Thank you

Viewing all 941 articles
Browse latest View live