Android Question Dialogs getTitle and Button

Emme Developer

Well-Known Member
Licensed User
Longtime User
How can i get Title label from dialog? Is possible also to get buttons, title, and edit text in Input Dialog?
Thanks!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You cannot get the title label, however you can update the title text and get the buttons:
B4X:
Sub Activity_Click
   Dim cd As ColorDialog
   Dim sf As JavaObject = cd.ShowAsync("Choose Color", "Yes", "Cancel", "No", Null, False)
   Dim b As Button = sf.RunMethod("getButton", Array(DialogResponse.POSITIVE))
   b.Color = Colors.Red
   Dim cs As CSBuilder
   sf.RunMethod("setTitle", Array(cs.Initialize.Color(Colors.Yellow).Append("Title").PopAll))
   Wait For (sf) Dialog_Result(Result As Int)
   If Result = DialogResponse.POSITIVE Then
     Activity.Color = cd.RGB
   End If
End Sub

I haven't tried to access the input dialog field. It should be possible if you dig enough. It is very simple to create a similar dialog with CustomLayoutDialog and have access to everything that you need.
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
There is not any getView method. By the way, there is a setView method. I think you can put your own custom editText in dialog
There is also a setCustomTitle, i don't tried it, but i think you can add any view instead title (setCustomTitle(View customTitleView) )
 
Upvote 0
Top