Android Question How to use a Reflector

Marcus Araujo

Member
Licensed User
Longtime User
Hello!

I am trying to understand how to use a reflector but I am getting the error:
java.lang.NoSuchMethodException

I am trying to call the method getResolution to check the sensor resolution as described in http://developer.android.com/reference/android/hardware/Sensor.html#getResolution()

The code is below. PS is an initialized PhoneSensor object.

B4X:
Dim r As Reflector
Dim f As Float
r.Target = PS
f = r.RunMethod("getResolution")

What am I doing wrong?

Thanks!
 

walterf25

Expert
Licensed User
Longtime User
Hello!

I am trying to understand how to use a reflector but I am getting the error:
java.lang.NoSuchMethodException

I am trying to call the method getResolution to check the sensor resolution as described in http://developer.android.com/reference/android/hardware/Sensor.html#getResolution()

The code is below. PS is an initialized PhoneSensor object.

B4X:
Dim r As Reflector
Dim f As Float
r.Target = PS
f = r.RunMethod("getResolution")

What am I doing wrong?

Thanks!
you can use my library to obtain the resolution and other important information from the sensors the the regular phone sensors library doesn't provide.

https://www.b4x.com/android/forum/threads/phonesensorsextra-library.43175/#content


Cheers,
Walter
 
Upvote 0

Marcus Araujo

Member
Licensed User
Longtime User
Hi Walter,

I saw your library before but I could not use it properly.
Also, I want to learn how to use reflection.

About your library, my doubts are:
1) What is the parameter "info4" as Float?
2) Why does the library need internet permission?
3) How can I stop listening?

Thanks for your reply.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Hi Walter,

I saw your library before but I could not use it properly.
Also, I want to learn how to use reflection.

About your library, my doubts are:
1) What is the parameter "info4" as Float?
2) Why does the library need internet permission?
3) How can I stop listening?

Thanks for your reply.
You're kidding right?
The library is pretty much the same as the original, how much time did you spend on trying to figure it out with my library?
As far as the permission is probably a mistake, i probably forgot to take that out, as i was just learning how to wrap a library.
And I also might have forgot to include the StopListening method :)

Any how good luck in learning how to use reflection.

Cheers,
Walter
 
Upvote 0

Marcus Araujo

Member
Licensed User
Longtime User
No, I am not kidding.
I am a little slow today, but I cannot see any similarity of the "parameter thing" to any PhoneSensors functions.
Even in the android development page, there is no parameter to be called. So why does the function in your library need it?

Anyway, regardless of the library, do you know how to solve the reflection issue?
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
No, I am not kidding.
I am a little slow today, but I cannot see any similarity of the "parameter thing" to any PhoneSensors functions.
Even in the android development page, there is no parameter to be called. So why does the function in your library need it?

Anyway, regardless of the library, do you know how to solve the reflection issue?
No.
 
Upvote 0
Top