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

Library works fine from Eclipse but not Processing IDE

$
0
0

I'm trying to make sure Blepdroid (https://github.com/joshuajnoble/blepdroid) works well before I tell more people about it and I'm able to use it from Eclipse Luna (aka 4.4.2) without issues, e.g. I write a Processing app there and link it to the Processing Android library. It does not seem to work from the Processing IDE though, which is puzzling. Both places I'm using Android SDK 6.0 (v23) and the phone I'm using is a Nexus 6P running Android 6.0.1. My machine is a OSX 10.11, running Processing 3.2.1, Java 1.8._101 and with the newest released version of the Android Mode installed.

One more curiosity that may (or may not) be a clue: I can't println() from any of my Android sketches suddenly. I see them in Eclipse, but not the Processing IDE.

Any tips of what might be going on would be seriously appreciated, I'm not super savvy with what might be going on in the Android/Java internals


Is it possible to upload program to google app store?

$
0
0

I was wondering after I code my program what the steps are to get an app published on the google play store. Keyword: steps

How to select an image from Android device

$
0
0

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.

Audio file can't be found if too much files in data folder

$
0
0

Good day to everyone, I'm stuck in a problem since two days, googling everywhere and making only little steps forword. Now i decided to register me in this forum to ask for help :) . After some efforts i'm now able to run all kind of sketchs on my device "galaxy s2 (API 11)", via android mode, even displaying images by -> add file... (that creates a data folder) and all images are well understood by the device app. (processing 3.0.2, windows 10, 64 bit) When i was trying to put some audio, the first times i get crash from the app launched on the device, after i understood that the problem was that the file was not found by the apk app. So i found https://forum.processing.org/two/discussion/12819/how-do-i-get-sound-to-play-on-the-phone#latest

where @Akenaton (thanks you!) finally wrote a code that works. The problem now is that if i "run on device" the simple code, it works, but if i start inserting images in the data folder, at some number beethween 20 and 24 , during debug "j'arrive pas à préparer" it's shown (so, you are French :) i'm italian) .

What the hell?? Why if I increase the number of files ( size 3 or 4 MB, so no problem with total size) the try{}catch{} statement can't find the myfile.mp3???

I've done those tests without adding any additional line of code to the code that works (powered by Akenaton).

thanks for answering and for the attention ps: i also tried with my full code , and all images are well displayed and the sketch runs, without sounds,so the problem is just for .mp3 audio files

An error ocurred while running "android create avd"

$
0
0

Processing 3.2.1 installed. Android SDK installed, working. AVD API 23 Created, running on emulator. Windows 7. 64bits. When I run a sketch in emulator Processing brings me this message: temp

My device Galaxy Tab 2 - 10.1 just can't be detected.

Some idea to solve it? Thanks.

Running sketch independent from the computer

$
0
0

Hi!

I am able to run a sketch on my tablet while plugged into my computer, but how do I run a sketch on an Android device without USB connection. Am I missing something?

Thanks!

Save Screen Image

$
0
0

Hello, when i save the screen image, the result is a file with the correct name and the correct directory on my device, but the file is empy. This is my code:

void setup() { size(1200, 700); strokeWeight(4); background(255); textSize(30); rect(0,0,1200,700); rect(10,650,180,40); rect(1000,650,180,40); fill(0); text("CLEAR",40,680); text("FATTO",1040,680); }

void draw() { if (mouseY<640){ line(mouseX, mouseY, pmouseX, pmouseY);} if ((mouseX>10)&(mouseX<200)&(mouseY>650)&(mouseY<700)){ fill(255); noStroke(); rect(2,2,1195,645);stroke(0);} if ((mouseX>1000)&(mouseX<1200)&(mouseY>650)&(mouseY<700)){ fill(255); noStroke(); rect(2,645,1195,695); delay(100); saveFrame("/sdcard/infoconterm/firma.png"); delay(200); exit(); }}

I activated WR_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE.

Open sound control between tablet and computer message error (works on two computers)

$
0
0

Hey! I was able to get this code to work on two computers, but it's not working at all when I try to run the sketch independent of the browser on my tablet. I'm wondering if this has something to do with the port number or android mode?

Here is the code on my tablet:

    import oscP5.*;
    import netP5.*;


    Buttons button1;
    Buttons button2;

    OscP5 oscP5;
    NetAddress myRemoteLocation;

    void setup() {
      size(600,800);
      frameRate(25);
      /* start oscP5, listening for incoming messages at port 12000 */
      oscP5 = new OscP5(this,12000);



      myRemoteLocation = new NetAddress("192.168.1.179",12000);


      button1 = new Buttons();
      button1.x = 100;
      button1.y = 100;
      button1.w = 100;
      button1.h = 100;

      button2 = new Buttons();
      button2.x = 250;
      button2.y = 100;
      button2.w = 100;
      button2.h = 100;

    }


    void draw() {
      background(0);
      rectMode(CENTER);

      fill(squareColor, 0, 0);

     button1.display("hello");

     button2.display("fractured");

    }

    void mousePressed() {
       button1.clicked("hello");
       button2.clicked("testing");

    }

    void clicked(String wordMessage){
      float d = dist(x, y, mouseX, mouseY);
      if (d < 50) {
       boxBackground = 255;
       OscMessage myMessage = new OscMessage(wordMessage);
       oscP5.send(myMessage, myRemoteLocation);
       println(myMessage);
      }

Here is the code on my computer:

    import oscP5.*;
    import netP5.*;

    int circleColor = 200;

    OscP5 oscP5;
    NetAddress myRemoteLocation;

    void setup() {
      size(400,400);
      frameRate(25);
      oscP5 = new OscP5(this,12000);

      myRemoteLocation = new NetAddress("192.168.1.128",12000);
    }


    void draw() {
      background(0);
      rectMode(CENTER);

      fill(circleColor, 0, 0);
      ellipse(width/2, height/2, 100, 100);



    }


    void oscEvent(OscMessage theOscMessage) {

      print("### received an osc message.");
      //print(" addrpattern: "+theOscMessage.addrPattern());
      println(" typetag: "+theOscMessage.typetag());

      if(theOscMessage.checkAddrPattern("poopin")==true) {
        println("it worked!");

      } else if (theOscMessage.checkAddrPattern("hello")==true) {
       println("yay, it worked!");
      }

    }

Uploading to Google Play Store Error

$
0
0

I made an app and exported it using APDE however when I go to upload it to the play store I get this error:

"Upload failed Your APK cannot be analysed using aapt. Error output: Failed to run aapt dump badging: ERROR getting 'android:name' attribute: "

Does anyone know how to fix this?

Thanks

App taking consderable time while loading in Android mode, but java mode is normal.

$
0
0

Code is shown below. Please help.

                        import oscP5.*;
                        import netP5.*;

                        OscMessage myMessage;
                        OscP5 oscP5tcpClient;

                        float i;
                        float a = 0.0;
                        float inc = TWO_PI/25.0;

                        void setup() {
                        size(640, 360);

                          oscP5tcpClient = new OscP5( this, "127.0.0.1", 1234, OscP5.TCP);
                        }

                        void draw() {
                          background(255);
                          calcWave();
                          OscMessage myMessage = new OscMessage("");
                          myMessage.add(new float[] {sin(180+sin(a)*100.0), 180+sin(a)*100.0}); /* add an int to the osc message */
                          oscP5tcpClient.send(myMessage);

                        }

                        void calcWave() {
                          for (int i = 0; i < 600; i=i+4) {
                            line(i, 180, i, 180+sin(a)*100.0);
                            a = a + inc;
                          }
                        }

Send Integers from android phone over Bluetooth with bt.braodcast Function

$
0
0

Hi everybody, im struggeling while trying to send Integers from my android Phone of the Color Pixels of a wheel rgb image, to arduino over Bluetooth with the bt.braodcast Function.. Has anyone an Idea? i would apreciate it

Ketai Library

$
0
0

hii.. Has anyone used the bt.broadcast function for bluetooth ?

Android emulator mode not working on mac osx yosemite

$
0
0

I have a fresh install of processing and an updated java. I let processing load the android mode and then it asked to downlload the android emulator. this is a mid 2012 macbook pro running osx yosemite and latest download of processing 3.

when I go to the AVM manger and tell it to start manually I get the following output text:

Starting emulator for AVD 'Processing-0217' emulator: WARNING: VM heap size set below hardware specified minimum of 384MB emulator: WARNING: Setting VM heap size to 768MB emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable. CPU acceleration status: HAXM is not installed on this machine

I'm testing a helloworld script to see if it works and I get the following error message: "lost connection while device launching. try again"

debug: Emulator process exited with status 1. EmulatorController: Emulator never booted. NOT_RUNNING Error while starting the emulator. (NOT_RUNNING) Shutting down any existing adb server...

When I got to the AVM manager and tell it to start manually

Android App is not establishing the connection.

$
0
0

I have created Android app as tcp client and my pc is acting as tcp server(processing in java mode).I am using oscP5 library.

When i try to run android app on mobile (with Wifi or mobile data 'on'), black screen will appear. After few minutes, app got loaded with error (TcpClient IOException while trying to create a new socket processing).

But when i load the android app without internet connection, it works normally. But, of course, it's of no use.

Also, when i run both client and server in Java mode, everything works fine.

I have tried these things:

  • PC firewall off.
  • App has internet permission. I also checked Android manifest.
  • Changes the ip and port.
  • Checked the 'security type' of internet connection. Its same on mobile and PC.

Kindly help.

TCP Server

    import controlP5.*;
    import oscP5.*;
    import netP5.*;

    ControlP5 cp5;
    OscP5 oscP5tcpServer;
    OscMessage theOscMessage;
    String s = "";

    void setup() {
      size(360, 360);
      background(164);
      oscP5tcpServer = new OscP5(this, 12345, OscP5.TCP);
      PFont font = createFont("arial", 20);
      cp5 = new ControlP5(this);
      cp5.addTextfield("output")
        .setPosition(20, 100)
        .setSize(200, 40)
        .setFont(font)
        .setFocus(true)
        .setColor(color(255, 0, 0));
        textFont(font);}

    void oscEvent (OscMessage theOscMessage) {
      String thirdValue = theOscMessage.get(0).stringValue();
      s = thirdValue ;
      if (theOscMessage.checkAddrPattern("/test")==true) {
        println(thirdValue);}}

    void draw() {
      cp5.get(Textfield.class, "output").setText(s);}

TCP client

import oscP5.*;
import netP5.*;
import controlP5.*;

ControlP5 cp5;
OscMessage myMessage;
OscP5 oscP5tcpClient;

void setup() {
  size(360, 360);
  cp5 = new ControlP5(this);
  oscP5tcpClient = new OscP5( this, "141.44.219.124", 12345, OscP5.TCP);

  cp5.addButton("colorA")
    .setPosition(100, 100)
    .setSize(150, 39);

  cp5.addButton("colorB")
    .setPosition(100, 140)
    .setSize(150, 39);}

void draw() {
  background(0);}

public void colorA() {
  OscMessage myMessage = new OscMessage("/test");
  myMessage.add("Gavanpreet Singh"); /* add a string to the osc message */
  oscP5tcpClient.send(myMessage);}

public void colorB() {
  OscMessage myMessage = new OscMessage("/test");
  myMessage.add("InDP Project"); /* add a string to the osc message */
  oscP5tcpClient.send(myMessage);}

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?


function does not exist in AndroidMode.

$
0
0

info shows in the image klsjdf solved,It's version problem,If you using ""Add Mode" in P3.1or3.2 IDE,It didn't provide right version,You shoulde manualy find relate version from github,I answered myself below.But there no button to choose my own answer (- _ -!)

Why doesn't disconnect TCP client Android from TCP server PC?

$
0
0

This is my code:

import controlP5.*; import oscP5.*; import netP5.*;

/********************************************************************************/ ControlP5 cp5; controlP5.Button BCONECTAR, BDESCONECTAR; /********************************************************************************/

/********************************************************************************/ OscP5 oscP5tcpClient; NetAddress myServerAddress; /********************************************************************************/

PFont myFont;

/********************************************************************************/ int myColor = color(255), c1, c2; float n,n1; boolean INICIO=true; /********************************************************************************/

/********************************************************************************/ void setup() { size(540,960); noStroke();

myFont = createFont("Georgia", 32);

cp5 = new ControlP5(this); /********************************************************************************/ BCONECTAR = cp5.addButton("CONECTAR") .setValue(0) .setPosition(100,100) .setSize(180,75) ;

BCONECTAR.captionLabel() .setSize(50) .setFont(myFont) .toUpperCase(false) .setText("CONECTAR") ;

BCONECTAR.getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER);
/********************************************************************************/

BDESCONECTAR = cp5.addButton("DESCONECTAR") .setValue(1) .setPosition(100,195) .setSize(240,75) ;

BDESCONECTAR.captionLabel() .setSize(50) .setFont(myFont) .toUpperCase(false) .setText("DESCONECTAR") ;

BDESCONECTAR.getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER);
/********************************************************************************/ } /********************************************************************************/

/********************************************************************************/ void draw() { background(myColor); myColor = lerpColor(c1,c2,n); n += (1-n)* 0.1; } /********************************************************************************/

/********************************************************************************/ public void CONECTAR(int theValue) { println("CONECTAR: " + theValue); c1 = c2; c2 = color(0,160,100);
if(INICIO==false) { oscP5tcpClient = new OscP5(this, "192.168.1.97", 5000, OscP5.TCP); myServerAddress = new NetAddress("192.168.1.97", 5000); }
}

public void DESCONECTAR(int theValue) { println("DESCONECTAR: " + theValue); c1 = c2; c2 = color(150,0,0); if(INICIO==false) { oscP5tcpClient.stop(); oscP5tcpClient.dispose();
oscP5tcpClient.disconnect(myServerAddress); }
INICIO=false;
} /********************************************************************************/

When I push the button DESCONECTAR the server still says Connected.

Could you please show me the right way to close TCP client?

how can I Export Signed Package for older versions of Android? - legacy compatability

$
0
0

I'm trying to create APKs for use on older phones and older versions of android. I have tried installing the older Target SDKs to Processing 3, but I get the following build Errors.

BUILD FAILED C:\Users\user\AppData\Local\Temp\android1768334546505923503sketch\build.xml:15: The following error occurred while executing this line: C:\Users\user\AppData\Local\Temp\android1768334546505923503sketch\build.xml:28: Compile failed; see the compiler error output for details.

Is there a good way to make APKs compatible with old phones? Thanks.

How to solve Dx Dexer error" DX Merger failed"

$
0
0

HI. I am getting the folowing errors on Processing APDE: DX Merger failed Java.nio.BufferOverflowException. Long list of list of errors Please any hints? this is on Motorola Xoom Mz605

How to make Bluetooth status visible

$
0
0

Hii, i need to make the bluetooth status visible in the app, i am using this Code

/** * ControlP5 ScrollableList * * replaces DropdownList and and ListBox. * List can be scrolled by dragging the list or using the scroll-wheel. * * by Andreas Schlegel, 2014 * www.sojamo.de/libraries/controlp5 * */ import android.content.Intent; import android.os.Bundle;

import ketai.net.bluetooth.*;
import ketai.ui.*;
import ketai.net.*;
import oscP5.*;

import controlP5.*;
import java.util.*;





KetaiBluetooth bt;
String info = "";
KetaiList klist;

ArrayList<String> devicesDiscovered = new ArrayList();
boolean isConfiguring = true;

int rectColFactor = 0;

//****************************************************************************
// The following code is required to enable bluetooth at startup.
//********************************************************************
void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  bt = new KetaiBluetooth(this);
}

void onActivityResult(int requestCode, int resultCode, Intent data) {
  bt.onActivityResult(requestCode, resultCode, data);
}

//********************************************************************

void setup() {
  size(displayWidth, displayHeight);
        orientation(PORTRAIT);
        background(30, 30, 30);



   //start listening for BT connections
     bt.start();

}
//****************************************************************************
void draw() {
  enableBT();
  getInfo();
}
//*************************************************************************

//**************************************************************************************
void enableBT(){
 if (isConfiguring)
  {
    //-------------------- This stuff is for us to select the intended device
    // ketai lib's UI list is used

    ArrayList names;
   //background(255, 0, 0);
     klist = new KetaiList(this, bt.getPairedDeviceNames());
   isConfiguring = false; // make the "configuring" status false as we have successfully configured

  }

}

//**************************************************************************************

void getInfo(){

  if (!isConfiguring)
  {
  //After configuration everything happens here

    //first set a new background to say we are connecetd
    background(255, 255, 0);


  }
}

//*************************************************************************************
//****************************************************************************************************************************
//---------------------- For killing the list after you've selected a device to pair

void onKetaiListSelection(KetaiList klist) {
  String selection = klist.getSelection();
  bt.connectToDeviceByName(selection);
  //dispose of list for now
  klist = null;
}

//------------------------ Call back method to manage data received
void onBluetoothDataEvent(String who, byte[] data) {
  if (isConfiguring) {
    return;
  }
  //received
  info = new String(data);
  rectColFactor = Integer.parseInt(info);
}
//******************************************************************************

i tried with an If statment or boolean function in the void enableBT() Function, in the getInfo(), and in the void onKetaiList Selection function, by drawing a red or green ellipse , but i have always same result , if i am connected or not,

does anyone have an idea?

Viewing all 941 articles
Browse latest View live