Answer the question
In order to leave comments, you need to log in
Unity3d AndroidJavaObject.Call how to return data as multidimensional array?
Good afternoon!
I add to the Unity project work with bluetooth on Android.
In Eclipse I write in java:
Set<BluetoothDevice> pairedDevices = BLAD.getBondedDevices();
if(pairedDevices.size()>0){
String[][] devices = new String[2][] ;
devices[0] = new String[pairedDevices.size()];
devices[1] = new String[pairedDevices.size()];
for(BluetoothDevice device: pairedDevices){
++k;
devices[0][k-1]= device.getName();
devices[1][k-1]= device.getAddress();
}
return devices;
}
else{
String[][] devices = new String[1][];
devices[0] = new String[1];
devices[0][0]= "";
return devices;
}
}
public static string[][] GetPairedDevs(){
if (Application.platform == RuntimePlatform.Android){
return BTObj.Call<string[][]>("GetPairedDevices");
}
else{
string[][] ss = new string[1][];
ss[0] = new string[1];
ss[0][0] = "111";
return ss;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question