Android Question setElevation using reflection

Cableguy

Expert
Licensed User
Longtime User
How can I set the Elevation property using reflection?
 

corwin42

Expert
Licensed User
Longtime User
How can I set the Elevation property using reflection?

B4X:
Sub SetElevation(v As View, e As Float)
    Dim jo As JavaObject
    Dim p As Phone
   
    If p.SdkVersion >= 21 Then
        jo = v
        jo.RunMethod("setElevation", Array As Object(e))
    End If
End Sub

If you use minSdkVersion=21 in your app you can remeove the if/then which just checks if the app is running at least on API 21.
 
Upvote 0
Top