Android Question Return Text of each line by reflection lib

ArminKH

Well-Known Member
tnx mr stevel05 and DonManfred
thats work perfectly now with reflection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
and not work by using java object !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Untitled.png
 

ArminKH

Well-Known Member
@stevel05
im sorry excuse me again
can u please convert all java object parts in page 1 to reflection?because i dont want to use 2 lib together
 

stevel05

Expert
Licensed User
I think there should be enough info there for you to try it yourself. Post if you get a specific problem.
 

ArminKH

Well-Known Member
I think there should be enough info there for you to try it yourself. Post if you get a specific problem.
here is my code i am sorry mr stevel but i try always but i am not familar with java ok tnx

B4X:
Private Sub SaveTextLineByLine(ViewName As View)
    Dim Source As Reflector
        Source.Target=ViewName
    Dim Text As String=Source.RunMethod2("getText",Null,"java.lang.string")
    Dim Layout As Reflector=Source.RunMethod("getLayout")
    Dim LineCount As Int=Source.RunMethod2("getLineCount",Null,"java.lang.int")
    Dim TextByLine(LineCount) As String

    Dim LineStart,LineEnd As Int
        Dim R As Reflector
               R.Target = Layout
        Dim A As Int
            For A=0 To LineCount - 1
                LineStart=R.RunMethod2("getLineStart",A,"java.lang.int")
                LineEnd=R.RunMethod2("getLineEnd",A,"java.lang.int")
                TextByLine(A)=Text.SubString2(LineStart,LineEnd).Trim
            Next
End Sub
 

stevel05

Expert
Licensed User
You have to set the target with the Reflector, you can't do:

B4X:
Dim Layout As Reflector=Source.RunMethod("getLayout")
It needs to be:
B4X:
Dim Layout As Reflector
    Layout.Target=Source.RunMethod("getLayout")
 
Top