Android Question Is Array / Is String Array

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Checking a object for being a string array

I can do

B4X:
Sub CheckThis(PassObj as Object)

If PassObj is String then ....
if PassObj is Boolean then ...

How would I check the PassObj for being a String Array

Have tried

If PassObj is Array
If PassObj is String()


ALSO - how would I check for a typeface

if PassObj is Typeface

BobVal
 

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
Hi,
I did it that way. I do not know if this is a good code.

B4X:
Dim a(10) As String
a(0)="Hello world"

Dim obj As Object
obj=a

CheckThis(obj)

Sub CheckThis(PassObj As Object)

    If GetType(PassObj).ToLowerCase="[ljava.lang.string;" Then

        Dim c() As String =PassObj
        Log(c(0))
            
    End If

End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…