My app runs smoothly in almost all android devices of samsung , lg ,dell etc . but while running in iberry bt07 tab application stops and gives an error message of "number format exception" . What is the problem ?
You should check the logs for the full error message.
There are several log viewers in the market which you can use if you don't have direct access to the device.
You should check the logs for the full error message.
There are several log viewers in the market which you can use if you don't have direct access to the device.
You trying to set a String value to an Int value ! P1.Color is an Int. cursor1.getString("color") is a String.
What type of variable is in the "color" column ?
I see that the value received from your db is "colors.white". Note that colors.white is a number in b4a but NOT when given from another source i.e. when you supply it as a string. A solution would be to fill your colors' field with integer representations of desired colors.
Since it appears you are storing the colors as strings as noticed by Klaus and mc73, perhaps you can do something like this:
B4X:
Dim strColor As String
strColor = Cursor1.getString("color")
P1.Color = ConvertColors(strColor)
B4X:
Sub ConvertColors(MyColor As String) As Int
MyColor=MyColor.SubString(MyColor.IndexOf(".")+1).ToUpperCase
Select MyColor
Case "BLACK"
' Return -16777216
Return Colors.Black
Case "BLUE"
Return Colors.Blue '-16776961
Case "WHITE"
Return Colors.White
Case "YELLOW"
Return Colors.Yellow '-256
Case "CYAN"
Return Colors.Cyan
Case "RED"
Return Colors.RGB(255,0,0) 'you can use Colors.Red
Case "MAGENTA"
Return Colors.Magenta
End Select
End Sub