Android Question How can I read some properties from a variable?

Discussion in 'Android Questions' started by Myr0n, Jan 25, 2015.

  1. Myr0n

    Myr0n Active Member Licensed User

    I am trying to guess how to read some properties from a variable.
    tempScreenS.jpg
    My code is
    Code:
    Dim db As JackcessDatabase
        db.Open(
    File.DirRootExternal & "/Northwind.mdb")
        
    Dim Table As JackcessTable
        Table.Initialize(db.GetTable(
    "FieldTypes"))
        Table.Reset
    The properties that I want to read are from the variable Table, like the screenshot, and I am interesting in one of those properties, that is highlighted on the screenshot.
    Could you help me please.

    Thank you so much.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    I guess that the library doesn't expose this property.
    You will need to use Reflection to get this value. It is not so simple in this case.
     
  3. Myr0n

    Myr0n Active Member Licensed User

    Ok, thank you Erel,
    Before to post this message I tried with JavaObject but I did not have good results.
    I tried with the actual wrapped library Jackcess but the problem that I found is that there is not include a method getColumns() that exists in java.

    I tried with
    Dim JO as JavaObject
    Log(jo.RunMethod("getcolumns",Array As Object("")))

    the previous said code gave the error:
    java.lang.RuntimeException: Method: getcolumns not found in: anywheresoftware.b4a.objects.JackcessDatabase$JackcessTable

    and the next one,
    Log(jo.GetField("_columns"))

    said:
    java.lang.RuntimeException: Field: _columns not found in: anywheresoftware.b4a.objects.JackcessDatabase$JackcessTable

    anyone has a similar code where I can do some test I figure out, please.

    Thank you
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Try to use Reflection library instead. JavaObject only allows you to access public fields and methods. These fields are probably private.
     
  5. Myr0n

    Myr0n Active Member Licensed User

    Thank you Erel, I start working on it.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice