Transferring data to Android - ADB, Processing

Hello!

I've been working on a project where i want to send a set of variables from an Arduino (temperature, pressure and number of ionizing events per second - radiation) to an Android device, and have used Processing to make a program on the Android. I have the Mega ADK board, and send the data using android debug bridge (because my phone only supports this mode...). I found this code for receiving the data on the Android:

  this.server.addListener(new AbstractServerListener() {

    @Override
      public void onReceive(Client client, byte[] data)
    {

      sensorValueTemp = data[0];
      sensorValueTrykk1 = (data[1]);
      sensorValueTrykk2 = (data[2]);
      sensorValueTrykk3 = (data[3]);
      sensorValueCPS = (data[4]);
      
    };
  }

And this code for sending the bytes from the Arduino:

if (millis()-lastTime > 1000)
  {
    
   byte data[5] = {temperature, trykk1, trykk2, trykk3, CPS};
   connection->write(5,(uint8_t*)&data);

    lastTime = millis();
  }

I'm trying to show the data on the screen of the phone, but nothing shows up, so something is obviously wrong...

textAlign(CENTER, TOP);
  
   text(
       "temp: " + (sensorValueTemp) + "\n" +
       "trykk1: " + (sensorValueTrykk1) + "\n" +
       "trykk2: " + (sensorValueTrykk2) + "\n" +
       "trykk3: " + (sensorValueTrykk3) + "\n" +
       "cps: " + (sensorValueCPS), 160, 180);

All of my variables' values should be within the range from 0 to 255, and I've tried to Serial.print them and they show up perfectly there. Have anybody tried something similar before, or see something wrong in the code?

The code is only part of it and it is dependent on the communication shield you add to your arduino (WIFI, ethernet, bluetooth etc, serial..)... The code you showed doesn't make any sense in context.

What is connection? Most write() methods take a single value or an array and a length. I have yet to see one that takes a length and then an array.