davidt Member Licensed User Longtime User Jul 5, 2016 #1 I am attempting to access a method in a third party Jar file and am obviously missing something key with regards to the passing of parameters when using RunMethod to call the getSpeed method. (I have very little java experience). I have read the Tutorial regarding using #Additional Jar and JavaObject, but am getting a Runtime Exception: Method: getSpeed not matched. I have attached a small test project (GarminAPI-Test.zip) along with the Third Party Jar file and the JavaDoc for the Speed class (Speed.zip). Any help would be most appreciated. Attachments GarminAPI-Test.zip GarminAPI-Test.zip 7.8 KB · Views: 335 Speed.zip Speed.zip 69.5 KB · Views: 340
I am attempting to access a method in a third party Jar file and am obviously missing something key with regards to the passing of parameters when using RunMethod to call the getSpeed method. (I have very little java experience). I have read the Tutorial regarding using #Additional Jar and JavaObject, but am getting a Runtime Exception: Method: getSpeed not matched. I have attached a small test project (GarminAPI-Test.zip) along with the Third Party Jar file and the JavaDoc for the Speed class (Speed.zip). Any help would be most appreciated.
Erel B4X founder Staff member Licensed User Longtime User Jul 5, 2016 #2 It is not a static method so you cannot use InitializeStatic. You can use InitializeNewInstance to call the constructor however it will not be useful as you will just get the speed that you passed to the constructor. Upvote 0
It is not a static method so you cannot use InitializeStatic. You can use InitializeNewInstance to call the constructor however it will not be useful as you will just get the speed that you passed to the constructor.
davidt Member Licensed User Longtime User Jul 5, 2016 #3 Thanks Erel for you reply. I do really appreciate your time. I have found another class called Breadcrumb that contains the location, heading, speed and timeStamp data fields. The description is as follows: The Breadcrumb class encapsulates the GPS position data associated with a point in a track log. The data in a breadcrumb object includes: latitude, longitude, speed and heading. Breadcrumbs are constant, the value of their data fields cannot be changed after they have been created. As such, the Breadcrumb class contains only getter functions and not setters. Based on your comments, would it make sense that I would need to use InitializeNewInstance against the Breadcrumb class and then retrieve the speed from it as I have done below? The code below compiles and does not issue any runtime errors however I'll need to test it on an actual Garmin device now (instead of my phone) to see what getSpeed returns as it is currently returning zero. Code: Copy jo.InitializeNewInstance("com.garmin.android.fleet.api.Breadcrumb", Null) Speed2 = jo.RunMethod("getSpeed", Null) Thanks again for your help Attachments Breadcrumb.zip Breadcrumb.zip 4.1 KB · Views: 321 Upvote 0
Thanks Erel for you reply. I do really appreciate your time. I have found another class called Breadcrumb that contains the location, heading, speed and timeStamp data fields. The description is as follows: The Breadcrumb class encapsulates the GPS position data associated with a point in a track log. The data in a breadcrumb object includes: latitude, longitude, speed and heading. Breadcrumbs are constant, the value of their data fields cannot be changed after they have been created. As such, the Breadcrumb class contains only getter functions and not setters. Based on your comments, would it make sense that I would need to use InitializeNewInstance against the Breadcrumb class and then retrieve the speed from it as I have done below? The code below compiles and does not issue any runtime errors however I'll need to test it on an actual Garmin device now (instead of my phone) to see what getSpeed returns as it is currently returning zero. Code: Copy jo.InitializeNewInstance("com.garmin.android.fleet.api.Breadcrumb", Null) Speed2 = jo.RunMethod("getSpeed", Null) Thanks again for your help
Erel B4X founder Staff member Licensed User Longtime User Jul 5, 2016 #4 I'm sure that it is more complicated than this. You need to first learn the Java code that interacts with this library. Upvote 0
I'm sure that it is more complicated than this. You need to first learn the Java code that interacts with this library.