Guys, when run this code in Phone and Emulator. Android 4+ the cursor disappear when use backcolor. If a general problem or make some mistake.
Thanks again.
ANY SUGESTIONS, WHY?
Thanks Ricardo.
Thanks again.
B4X:
Sub Activity_Create(FirstTime As Boolean)
str.Initialize(str)
Activity.AddView(str,0,0,200,200)
End Sub
Sub Activity_Resume
str.Text="Texto========11111111111111Texto"
a=MakeColor(str.Text)
str.Text=a
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub MakeColor(sourcetxt As String) As RichString
Dim backcolor,frontcolor,numcolor,colorlevel As Int 'Take current color string
Dim wordpos As Long
Dim inpstr As String
inpstr=sourcetxt
richstr.Initialize(inpstr)
'==============================================================
backcolor=Colors.black ' PROBLEM, WHEN USE BACKCOLOR
'==============================================================
numcolor=Colors.white
frontcolor=Colors.White
colorlevel=Colors.white
For wordpos=0 To inpstr.Length-1 ' navigate de string.
Select inpstr.CharAt(wordpos) ' analize this char.
Case "+","=","/","*",".",":"," ","-","#","%","<",">","&"
onelinecolor(Colors.Blue,backcolor, wordpos, wordpos+1)
Case Chr(10),Chr(32),Chr(9),Chr(13),Chr(15),Chr(44),Chr(34) ,Chr(39) 'SPACE TAB,LF,CR,COMA
richstr.backcolor(backcolor, wordpos, wordpos+2)
Case "1","2","3","4","5","6","7","8","9","0"
onelinecolor(numcolor,backcolor, wordpos, wordpos+1)
Case Else
richstr.Color(Colors.White,wordpos,wordpos+1 ) 'CURSOR WORK HERE BECAUSE DON'T USE BACKCOLOR
End Select
Next
Return richstr
End Sub
Sub onelinecolor (col As Int,bcol As Int,pos As Int,size As Int)
richstr.Color(col,pos,size ) ' color funciones
richstr.backColor(bcol,pos,size ) ' color funciones
End Sub
ANY SUGESTIONS, WHY?
Thanks Ricardo.