Android Question B4XDialog cant access TitleBar view before the dialog is not showing

Alexander Stolte

Expert
Licensed User
Longtime User
Hey,

i want to change the Text Alignment on the titlebar, but if i access the title bar before the dialog is showing then an error occurs:
B4X:
java.lang.RuntimeException: Object should first be initialized (B4XView).

How can i modify it without showing the dialog?

B4X:
dialog.Initialize(Activity)
dialog.TitleBarColor = Layouts.xui.Color_ARGB(255,28, 32, 35) 'this works
    dialog.TitleBar.SetTextAlignment("CENTER","LEFT")'error
Wait For (dialog.ShowCustom(tmp_background, "Hochladen", "", "Abbrechen")) Complete (Result As Int)
    If Result = Layouts.xui.DialogResponse_Positive Then
  
    End If
 

Alexander Stolte

Expert
Licensed User
Longtime User
But now a new error occurs
B4X:
Dim sf As Object = dialog.ShowCustom(tmp_background, "Hochladen", "", "Abbrechen")
    dialog.TitleBar.SetTextAlignment("CENTER","LEFT")'error
B4X:
java.lang.RuntimeException: Type does not match (class anywheresoftware.b4a.BALayout)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…