ok, try it. thank you
Sub CreateBackground (intent As Int,midiInt As Int) As ColorDrawable
Dim cd As ColorDrawable
Try
cd.Initialize(Colors. RGB(200,120,120), 110dip)
If intent = 0x90 Or intent = 0x91 Then ' 0x90 0x91
cd.Initialize(Colors.RGB(200,120,120), 110dip)
Return cd ' --------- error line 575
Else
If midiInt < 48 Then
cd.Initialize(Colors.RGB(210,210,150),110dip)
Else If midiInt < 60 Then
cd.Initialize(Colors.RGB(220,220,170),110dip)
Else If midiInt < 72 Then
cd.Initialize(Colors.RGB(230,230,190),110dip)
Else If midiInt < 84 Then
cd.Initialize(Colors.RGB(240,240,220),110dip)
Else If midiInt < 96 Then
cd.Initialize(Colors.RGB(255,255,240),110dip)
End If
Return cd
' Dim keyString As String = noteStr.Replace("*","") & "#"
' keyboardButton.Background = mapButtonZuBackground.Get(keyString)
End If
Catch
Log(LastException)
End Try
' ..
Return cd
End Sub
Error occurred on line: 575 (Main)
java.lang.ClassCastException: java.lang.String cannot be cast to android.view.View
at anywheresoftware.b4a.objects.ViewWrapper.setBackground(ViewWrapper.java:105)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:733)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:352)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.objects.CompoundButtonWrapper$1.onCheckedChanged(CompoundButtonWrapper.java:44)
at android.widget.CompoundButton.setChecked(CompoundButton.java:154)
at android.widget.CompoundButton.toggle(CompoundButton.java:113)
at android.widget.CompoundButton.performClick(CompoundButton.java:118)
at android.view.View$PerformClick.run(View.java:20262)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5637)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
hmmm, difficult stuff... cannot comprehend casting error...
ok, error is not consistent - does not go to catch! only rises, if sub is called out of a loop, not if it is called from incoming data. Maybe time sensitive..
error occurs, when 'intent' = 53 or 'intent' = 67. Very obscur...
...got it!