Reflection library for clipboard Basic4Android

1.7k Views Asked by At

I am trying to learn a bit more about the libraries before purchasing this great software! I understand most of them in theory (without programming because I dont actually have them) except for the reflection library. I was trying to figure out how I would use the clipboard library (http://developer.android.com/reference/android/text/ClipboardManager.html) to put some text in the clipboard as an example for practice but everything I write does not seem correct.

This is what I have written so far (but have not tested):

Dim r As Reflector
r.target=r.RunMethod("java.text.clipboardmanager")
r.RunMethod2("settext","hello","java.lang.object")

ith hello being the text added to the clipboard but it seems incorrect with the java.text.clipboardmanager compared to the other examples of the reflection library I have seen where there is no dots in there. Could somebody please point me in the right direction or give me the code for the clipboard as a reference.

Help would be appreciated to help me understand more about this library!
1

There are 1 best solutions below

0
On

It is very easy, I put an example (that here does not seem that they want):


Code:

Sub Copia_Click
    Dim r As Reflector
    r.Target = r.GetContext
    Log(r.Target)
    r.Target = r.RunMethod2("getSystemService", "clipboard", "java.lang.String")    'CipboardManager
    Log(r.Target)
    Log(r.RunMethod2("setText",EditText1.Text,"java.lang.CharSequence"))
End Sub
Sub Pega_Click
    Dim r As Reflector
    r.Target = r.GetContext
    Log(r.Target)
    r.Target = r.RunMethod2("getSystemService", "clipboard", "java.lang.String")    'CipboardManager
    Log(r.Target)
    If r.RunMethod("hasText") Then
        EditText2.Text=r.RunMethod("getText")
        Log(r.RunMethod("getText"))
    Else
        ToastMessageShow("Error : No texto",True)
    End If
End Sub

I him hope to have helped. Luck.

Manel : www.sintecsl.es