Looking through the help in the Canvas object noticed what appears to be a line of code missing in the example.
Gradient1.Initialize("TOP_BOTTOM", Clrs)
Gradient1.Initialize("TOP_BOTTOM", Clrs)
B4X:
Canvas.DrawDrawable
Method
Draws a Drawable into the specified rectangle.
Example:
Dim Gradient1 As GradientDrawable
Dim Clrs(2) As Int
Clrs(0) = Colors.Green
Clrs(1) = Colors.Blue
[B]Gradient1.Initialize("TOP_BOTTOM", Clrs) 'Missing line ?[/B]
Canvas1.DrawDrawable(Gradient1, DestRect)
Activity.Invalidate
Returns : void
Parameter1 : Drawable1 As Drawable
Parameter2 : DestRect As Rect