What could I isolate must use r.Target command when I use refection Lib?

Theera

Expert
Licensed User
Longtime User
Hi all,
I'm still study the refection. I don't know that what could I know that I must use r.Target command. I've read about reflection lib,but I'm not good at English,I need explain more than someone.
 
Last edited:

JesseW

Active Member
Licensed User
Longtime User
I am no expert at reflection, but I can tell you that the reflection object must act upon another object. It must act, or do something with or to, an activity, view, or other object. The .Target property tells the reflector which object to act upon. Basically, it open up additional functionality of the target object. Also, it is not recommended to use it unless you understand both the reflector object and the target object thoroughly.

Hope this explanation helped... Cheers
 
Upvote 0

Theera

Expert
Licensed User
Longtime User
Hi JesseW,and all
Please see Erel's example ,I have never seen about assigned r.Target. Please explain more.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Some static methods dont need a object to act on.

Consider an example from Basic4Android (just to explain).

You have an object: a
Dim a as String
a.ToLowerCase

For reflection you will do,
Reflector.Target = a '(now reflector points to 'a')
Reflector.RunMethod("ToLowerCase") '(reflector runs the method ToLowerCase on Target a)


Now consider another example, to run LoadBitmap.
In B4A you run
LoadBitmap(FileDir,Filename)
but there is no object to run the method on. It is a static method that does not require an object to run on.

So in reflector you can just write:
Reflector.RunStaticMethod("LoadBitmap")

If you want my advice, you should forget about Reflection and first learn about Java to understand all of these concepts (classes, contructors, methods).
 
Upvote 0

Theera

Expert
Licensed User
Longtime User
Thank you for kind of you,thedesolatesoul I'm tried to learn more.

Some static methods dont need a object to act on.

It mean that If it isn't the static method,it always need a object to act on,Yes or No ?
 
Last edited:
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Upvote 0

Theera

Expert
Licensed User
Longtime User
Thank you very much again.
 
Upvote 0
Top