Android Question MsgBox2Async in color?

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
hi Guys,

is it possible to show msgbox2async in colors?
text color ?
background color ?

a short sample will be appreciated

thanks
 
Solution
Try this
B4X:
    Dim cs As CSBuilder
    cs.Initialize.Color(Colors.LightGray).Append("Hello World!").PopAll
    Dim mbas As JavaObject=Msgbox2Async(cs,cs,"o","c","n",Null, True)
    Dim cd As ColorDrawable
    cd.Initialize(xui.Color_Blue,0)
    mbas.RunMethodjo("getWindow",Null).RunMethod("setBackgroundDrawable",Array(cd))
    Wait For (mbas) Msgbox_Result (Result As Int)
    Log(Result)

teddybear

Well-Known Member
Licensed User
Try this
B4X:
    Dim cs As CSBuilder
    cs.Initialize.Color(Colors.LightGray).Append("Hello World!").PopAll
    Dim mbas As JavaObject=Msgbox2Async(cs,cs,"o","c","n",Null, True)
    Dim cd As ColorDrawable
    cd.Initialize(xui.Color_Blue,0)
    mbas.RunMethodjo("getWindow",Null).RunMethod("setBackgroundDrawable",Array(cd))
    Wait For (mbas) Msgbox_Result (Result As Int)
    Log(Result)
 
Last edited:
Upvote 0
Solution

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Try this
B4X:
    Dim cs As CSBuilder
    cs.Initialize.Color(Colors.LightGray).Append("Hello World!").PopAll
    Dim mbas As JavaObject=Msgbox2Async(cs,cs,"o","n","c",Null, True)
    Log(mbas.RunMethod("getWindow",Null))
    Dim cd As ColorDrawable
    cd.Initialize(xui.Color_Blue,0)
    mbas.RunMethodjo("getWindow",Null).RunMethod("setBackgroundDrawable",Array(cd))
    Wait For (mbas) Msgbox_Result (Result As Int)
    Log(Result)
wow that was quick - thank you
i will try and revert

in the meantime - can i translate an integer color code to a color ?
i mean i have the color code stored as integer - can i use it or convert it?
in windows / visual studio it is easy...
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Try this
B4X:
    Dim cs As CSBuilder
    cs.Initialize.Color(Colors.LightGray).Append("Hello World!").PopAll
    Dim mbas As JavaObject=Msgbox2Async(cs,cs,"o","c","n",Null, True)
    Log(mbas.RunMethod("getWindow",Null))
    Dim cd As ColorDrawable
    cd.Initialize(xui.Color_Blue,0)
    mbas.RunMethodjo("getWindow",Null).RunMethod("setBackgroundDrawable",Array(cd))
    Wait For (mbas) Msgbox_Result (Result As Int)
    Log(Result)
BEAUTIFUL!!
that worked perfectly
the only issue i have now is the buttons color - it is sort of green - can i set the color to something else?

thanks!
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
i have now is the buttons color - it is sort of green - can i set the color to something else?
Try the forum search:

 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Try the forum search:

thanks
looked at it and honestly i got lost

where do i put this code?
i meant changing the color dynamically so it can change within the code between other colors like the title and msg body

thanks
 
Upvote 0
Top