Android Tutorial DialogView: A complete walk-through guide

Thraka

Member
Licensed User
Longtime User
That is what I was doing originally, but the thread there doesn't stop and moves on leaving the sub while the window is still open waiting for the user to click something.
 

Thraka

Member
Licensed User
Longtime User
That's what I had originally, but it didn't work. I think there may be an issue with nested dialogs...

Another issue, in the same class, I cannot get the dialog show event to fire either.
B4X:
Public Sub Initialize
    cities.Initialize 'map object
    layout = dialog.LoadLayout("setupweather")
End Sub

Sub dialog_Show
    'this never fires.
End Sub

'This is what I call from outside my wrapper to show the dialog
Public Sub Show
    lstLocations.CallBack = Me
 
    'Code does pause here waiting for a close, unlike the post above which doesn't pause and wait.
    layout.ShowOk("Edit Weather Locations", "Close")
End Sub
 

awoo060

Member
Licensed User
Longtime User
Stupendous work!

Is there anyway to have my initial panel use rounded corners? I have kind of found ways, but the black panel on which it sits becomes visible instead of being transparent...
 

little3399

Active Member
Licensed User
Longtime User
Hi, Periklis

I found a question about using dialogview in Activity_KeyPress routine ... it can not seem to work ! Ple help .

here was my code ... I want to show the PopMenu when I press the BACK TO HOME key

Sub Activity_KeyPress (KeyCode As Int) As Boolean

Dim DialogLayout As DialogViewLayout
DialogLayout = Dialog.LoadLayoutMultiple("CountMenu", "CountMenu", "CountMenu")
DialogLayout.ShowOk("Option","Close)


End Sub
 

henrywood

Active Member
Licensed User
Longtime User
I am trying to using DialogView.
My Dialog has a CustomView (as chosen in designer as it will not let me choose anything else)
Before showing this dialogview, I would like to replace this customView with a CustomListView.

How can this be done ?

My code thus far:

B4X:
Sub Globals
     Dim ShareToDialog As DialogView
End Sub


Sub Test
    ' Ask if add to another list
     ShareToDialog.Options.Animation = Main.DIALOGS_ANIMATION_DEFAULT
     ShareToDialog.Name = "share_to_list_dialog"
     Dim DialogLayout As DialogViewLayout
     DialogLayout = ShareToDialog.LoadLayout("share_to_list_dialog")
     Dim lv As CustomListView = DialogLayout.Views.Get("ListView1")
     Dim lbl1 As Label = DialogLayout.Views.Get("Labe11")
     Dim lbl2 As Label = DialogLayout.Views.Get("Label2")
     lbl1.Text = Strings.FE.Get("add_entry_shoppinglist") 
     lbl2.Text = Strings.FE.Get("add_entry_shoppinglist") 

     Dim lists As Map
     lists.Add("1", "Family List")
     lists.Add("2", "Friends List")

     For Each listID As String In lists.Keys
 
       lv.Add(addToCustomViewListShareToDialog(listID, lists.Get(listID), 50dip, listID)

     Next
     Dim Result As Int = DialogLayout.ShowYesNo(Main.APPLICATION_NAME_HUMAN & ": " & Strings.FE.Get("share_to_lists"), Strings.FE.Get("cancel"), Strings.FE.Get("done"))

 


   Else



   End If

End Sub

Sub addToCustomViewListShareToDialog(listId As String, listName As String)

   Dim p As Panel
   p.Initialize("")
   p.Color = Colors.Black
   Dim chkb As CheckBox
   chkb.Initialize("chkb")
   ckkb.Tag = listId
   p.AddView(chkb, 5dip, 2dip, 50dip, 50dip)
   Return p

End Sub

Sub share_to_list_dialog_Dismiss(DialogResult As Int) As Boolean

If DialogResult = DialogResponse.POSITIVE Then

    'Is this correct ?
    Dim cv As CustomListView = ShareToDialog.Views.Get("ListView1")

    For i=0 To cv.GetSize - 1

         Dim pnl As Panel
         pnl = cv.GetPanel(i)
         Dim chk As CheckBox
         chk = pnl.GetView(0)

         If chk.Checked = True Then

              ' TODO: Do our deeds


         End If

    Next

    clv1.Clear
    LoadFromDB

End if

End Sub
 
Last edited:

tagwato

Member
Licensed User
Longtime User
Wonderful addition to B4A, Periklis !

Please, could you check the behaviour of DialogView.Options.Dimensions.MODE_STRETCH_TEXT ?
It seems that it is not properly adjusting the text sizes of Labels and Listviews when we change the dialog dimensions.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…