6

Based On this thread I want to pass array of strings as argument lik this :

Object obj = new String[] {"Hello","Bye"};
channel.invokeMethod("foo",obj, new MethodChannel.Result(){
...
);

but it shows error :

Unsupported value: [Ljava.lang.String .

How can I do that?

Saeiddjawadi
  • 312
  • 2
  • 13

1 Answers1

6

The StandardMessageCodec doesn't support arrays (except of int and byte). For objects, it supports Java collections, like List and Map. Change your array of String to a List<String>.

ArrayList<String> args = new ArrayList<>();
args.add("Hello");
args.add("Bye");
channel.invokeMethod("foo", args, new MethodChannel.Result(){
Richard Heap
  • 48,344
  • 9
  • 130
  • 112