Android Question Manual remove panel

victormedranop

Well-Known Member
Licensed User
Longtime User
Hi, I need some help. I'm creating dynamically some panels and inserting some text.
bu i haven't found the way to remove one panel or two. I just found the way removing all
the views and them recreating all.

this is my function. start and stop works fine, but not remove.

what a I need to do I remove a panel with time function.

thanks

victor


B4X:
Sub sliding (control As String )
Dim panels(capilla.size) As Panel
Dim lbl(capilla.size),lb2(capilla.size) As Label
If control = "start" Then
Dim bd As BitmapDrawable
bd.Initialize(LoadBitmap(File.DirAssets,"bacground.png"))
Log("Starting sliding panel")
For i = 0 To capilla.size - 1
panels(i).Initialize("panels")
panels(i).Background = bd
lbl(i).Initialize("")
lb2(i).Initialize("")
lbl(i).Text = nombre_completo.Get(i)
lbl(i).TextSize = 90
lbl(i).Gravity = Gravity.CENTER_HORIZONTAL
lbl(i).Typeface = myFont
lbl(i).TextColor = Colors.RGB(115,0,0)
lb2(i).Text = capilla.Get(i)
lb2(i).TextSize = 80
lb2(i).Gravity = Gravity.CENTER_HORIZONTAL
lb2(i).Typeface = myFont
lb2(i).TextColor = Colors.RGB(115,0,0)
panels(i).AddView(lbl(i), 20%x, 40%y, 60%x,20%y)
panels(i).AddView(lb2(i), 20%x, 70%y, 60%x, 20%y)
Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y)
Next
sd.Initialize
sd.Panels = panels
SlidingPanels.Initialize(sd, SlidingDuration)
sd.targetPanel = 0
sd.currentPanel = currentPanelBeforePaused - 1
ChangePanel(True)
else if control = "stop" Then
Log("Stoping Panels")
For w = 0 To capilla.size - 1
panels(w).RemoveViewAt(w)
Next
Activity.RemoveAllViews
Activity.AddView(ImageView1,0%x,0%y,100%x,100%y)
Activity.AddView(label1,15%x,40%y,70%x,10%y)
Activity.AddView(label2,15%x,55%y,70%x,10%y)
Activity.AddView(JSSimpleArcLoader1,90%x,10%y,5%x,5%y)
Activity.Addview(videoview1,0%x,0%y,100%x,100%y)
Activity.AddView(label_id,80%x,90%y,20%x,10%y)
Activity.AddView(label_ip,80%x,93%y,20%x,10%y)
Activity.AddView(image_logo,0%x,0%y,100%x,100%y)
Activity.LoadLayout("main")
image_logo.Visible = True
image_logo.BringToFront
else if control = "remove" Then
Log("removing panels")
For w = 0 To capilla.size - 1
panels(w).RemoveViewAt(w)
Next
End If
End Sub
 

victormedranop

Well-Known Member
Licensed User
Longtime User
I see now more clear
i add this configition and can remove one panel, panel (0)

B4X:
    else if control = "remove" Then 
        Log("removing panels")
        Log("Sd length : " & sd.Panels.Length)
        sd.Panels(0).RemoveViewAt(0)
        nombre_completo.RemoveAt(0)
        capilla.RemoveAt(0)
        fecha_entrada.RemoveAt(0)
        hora_entrada.RemoveAt(0)
        fecha_salida.RemoveAt(0)
        hora_salida.RemoveAt(0)
 
Upvote 0
Top