A apty Active Member Licensed User Longtime User Feb 5, 2018 #1 i have a java method that depends on arguments passed to it. I would like to pass these arguments to the inline java method via java object. for example java Code: Copy public void stx(String[] argsx) throws Exception { otherMethod.create(argsx); } Now i want to pass the arguments via java object like so (tried it this way but the app force closes): Code: Copy J.RunMethod("stx",Array(args)) i have defined args as shown below: Code: Copy Dim args() As String args = Array As String ("mx","lp","dg") in other words, i want to pass "mx","lp","dg" as a single string to the java method. How do i do it?
i have a java method that depends on arguments passed to it. I would like to pass these arguments to the inline java method via java object. for example java Code: Copy public void stx(String[] argsx) throws Exception { otherMethod.create(argsx); } Now i want to pass the arguments via java object like so (tried it this way but the app force closes): Code: Copy J.RunMethod("stx",Array(args)) i have defined args as shown below: Code: Copy Dim args() As String args = Array As String ("mx","lp","dg") in other words, i want to pass "mx","lp","dg" as a single string to the java method. How do i do it?
Erel B4X founder Staff member Licensed User Longtime User Feb 5, 2018 #2 Your code is correct. Check the logs for the error message and post it. Upvote 0
A apty Active Member Licensed User Longtime User Feb 5, 2018 #3 i am really sorry i framed the question the wrong way. The java method has an array of strings as shown below: Code: Copy public void stx(String aa,String bb, String cc) throws Exception { otherMethod.create(new String[]{aa,bb,cc}); } Now i want to combine the aa,bb,cc to be a single string and pass it on b4a javaobject then i will modify the java method "stx" to accept one string instead of 3. Upvote 0
i am really sorry i framed the question the wrong way. The java method has an array of strings as shown below: Code: Copy public void stx(String aa,String bb, String cc) throws Exception { otherMethod.create(new String[]{aa,bb,cc}); } Now i want to combine the aa,bb,cc to be a single string and pass it on b4a javaobject then i will modify the java method "stx" to accept one string instead of 3.
Erel B4X founder Staff member Licensed User Longtime User Feb 5, 2018 #4 I'm sorry but I don't understand what you mean with "to be a single string". The correct way to call this method is with: Code: Copy jo.RunMethod("stx", args) Define args as an array of objects instead of strings. Upvote 0
I'm sorry but I don't understand what you mean with "to be a single string". The correct way to call this method is with: Code: Copy jo.RunMethod("stx", args) Define args as an array of objects instead of strings.
A apty Active Member Licensed User Longtime User Feb 5, 2018 #5 thanks. I mean i want to convert the above method to be something like the below: Code: Copy public void stx(String[] args) throws Exception { otherMethod.create(new String[]{args}); } where args now contain aa,bb,cc which i will pass through a java object Upvote 0
thanks. I mean i want to convert the above method to be something like the below: Code: Copy public void stx(String[] args) throws Exception { otherMethod.create(new String[]{args}); } where args now contain aa,bb,cc which i will pass through a java object