Bagus W Bagus W - 18 days ago 5
Java Question

how to use int[] in android java

first i'm sorry ,i'm a newbie at this,so i confuse about java lang..

if i have a function like this..

public static void sendRcOverrideMsg(drone, int[] rcOutputs) {
msg_rc_channels_override msg = new msg_rc_channels_override();
msg.chan1_raw = (short) rcOutputs[0];
msg.chan2_raw = (short) rcOutputs[1];
msg.chan3_raw = (short) rcOutputs[2];
msg.chan4_raw = (short) rcOutputs[3];
msg.chan5_raw = (short) rcOutputs[4];
msg.chan6_raw = (short) rcOutputs[5];
msg.chan7_raw = (short) rcOutputs[6];
msg.chan8_raw = (short) rcOutputs[7];
msg.target_system = drone.getSysid();
msg.target_component = drone.getCompid();
drone.getMavClient().sendMessage(msg, null);
}


how can i call that function..
i already call like this :

sendRCOverrideMsg(drone, "//what should i fill in this int[]").. sry before, thanks, hopefully somebody can helm me at this.

Answer
int[] outputs = new int[]{1,2,3,4,5,6,7,8};
sendRcOverrideMsg(drone, outputs);
Comments