R Roger Garstang Well-Known Member Licensed User Longtime User May 18, 2012 #1 I know this is probably simple, but I can't get this to work. I need to pass a float[] to a method, how is that wrote in a Reflector? From the documentation it looks like the type is "[F"...I've tried "java.lang.float" too, but neither work. I'm guessing I'm not using the correct RunMethod- I've tried 2 and 4. I looked at RunPublicmethod, but can't figure out what it is wanting for the Class stuff. setCornerRadii is a Public method though.
I know this is probably simple, but I can't get this to work. I need to pass a float[] to a method, how is that wrote in a Reflector? From the documentation it looks like the type is "[F"...I've tried "java.lang.float" too, but neither work. I'm guessing I'm not using the correct RunMethod- I've tried 2 and 4. I looked at RunPublicmethod, but can't figure out what it is wanting for the Class stuff. setCornerRadii is a Public method though.
agraham Expert Licensed User Longtime User May 18, 2012 #2 You don't say what object you are trying this on, don't give the code you are using nor the error that you get, so guessing what you are doing wrong is a little difficult. If it's a GradientDrawable, for example, it should be something like Code: Copy Dim radii(8) As Float .... Obj1.Target = MyGradientDrawable Obj1.RunMethod2("setCornerRadii", radii, "[F") If that doesn't work post a simple project that fails. Upvote 0
You don't say what object you are trying this on, don't give the code you are using nor the error that you get, so guessing what you are doing wrong is a little difficult. If it's a GradientDrawable, for example, it should be something like Code: Copy Dim radii(8) As Float .... Obj1.Target = MyGradientDrawable Obj1.RunMethod2("setCornerRadii", radii, "[F") If that doesn't work post a simple project that fails.
R Roger Garstang Well-Known Member Licensed User Longtime User May 18, 2012 #3 Yes, it is a GradientDrawable I am using for the states of a button. I got it working fine with the built in code, but wanted to have different or no radius curves on specific corners of the button. When I try it formatted how you did above it comes back with: Code: Copy ref.RunMethod2(\ javac 1.7.0_03 src\com\primarymarking\etwist\cases.java:326: error: no suitable method found for NumberToString(float[]) _ref.RunMethod2("setCornerRadii",BA.NumberToString(_radii),"[F"); ^ method BA.NumberToString(long) is not applicable (actual argument float[] cannot be converted to long by method invocation conversion) method BA.NumberToString(int) is not applicable (actual argument float[] cannot be converted to int by method invocation conversion) method BA.NumberToString(double) is not applicable (actual argument float[] cannot be converted to double by method invocation conversion) 1 error Upvote 0
Yes, it is a GradientDrawable I am using for the states of a button. I got it working fine with the built in code, but wanted to have different or no radius curves on specific corners of the button. When I try it formatted how you did above it comes back with: Code: Copy ref.RunMethod2(\ javac 1.7.0_03 src\com\primarymarking\etwist\cases.java:326: error: no suitable method found for NumberToString(float[]) _ref.RunMethod2("setCornerRadii",BA.NumberToString(_radii),"[F"); ^ method BA.NumberToString(long) is not applicable (actual argument float[] cannot be converted to long by method invocation conversion) method BA.NumberToString(int) is not applicable (actual argument float[] cannot be converted to int by method invocation conversion) method BA.NumberToString(double) is not applicable (actual argument float[] cannot be converted to double by method invocation conversion) 1 error
R Roger Garstang Well-Known Member Licensed User Longtime User May 18, 2012 #4 Just tried the radii as Int and String too keeping [F for the type. Int fails just like Float and String I had tried multiple ways before as well and they compile, but give an argument error when running. Upvote 0
Just tried the radii as Int and String too keeping [F for the type. Int fails just like Float and String I had tried multiple ways before as well and they compile, but give an argument error when running.
R Roger Garstang Well-Known Member Licensed User Longtime User May 18, 2012 #5 Ok, just played with it some more and got it to work with: Code: Copy RunMethod4("setCornerRadii", Array As Object(Array As Float(0,0,25,25,25,25,0,0)), Array As String("[F")) Seems to me this is exactly what we were saying with the other way though. Upvote 0
Ok, just played with it some more and got it to work with: Code: Copy RunMethod4("setCornerRadii", Array As Object(Array As Float(0,0,25,25,25,25,0,0)), Array As String("[F")) Seems to me this is exactly what we were saying with the other way though.
agraham Expert Licensed User Longtime User May 18, 2012 #6 The penny has just dropped - I've not done any Android work for quite a while now so I'm very rusty. RunMethod2 of course takes a string parameter, you need an object parameter variant to pass an array. Code: Copy Obj1.RunMethod4("setCornerRadii", Array As Object( radii ) Array As String( "[F" )) Upvote 0
The penny has just dropped - I've not done any Android work for quite a while now so I'm very rusty. RunMethod2 of course takes a string parameter, you need an object parameter variant to pass an array. Code: Copy Obj1.RunMethod4("setCornerRadii", Array As Object( radii ) Array As String( "[F" ))