#AdditionalJar: android-support-v7-palette
#AdditionalJar: android-support-v4
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
GetPalette(LoadBitmap(File.DirAssets, "smiley.png"))
End Sub
Sub GetPalette(bmp As Bitmap)
Dim jo As JavaObject
jo.InitializeStatic("android.support.v7.graphics.Palette")
Dim e As Object = jo.CreateEvent("android.support.v7.graphics.Palette.PaletteAsyncListener", _
"generated", Null)
jo.RunMethodJO("from", Array(bmp)).RunMethod("generate", Array(e))
End Sub
Sub Generated_Event (MethodName As String, Args() As Object) As Object
Dim palette As JavaObject = Args(0)
Log(palette.RunMethod("getDarkVibrantColor", Array(0)))
Return Null
End Sub