As with ImageView1_Click to remove the selected item from CustomListView?
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private Chooser As ContentChooser
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private MyCLV As CustomListView
Private Button1 As Button
Private CLV_IV As CustomListView
Private ImageView1 As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Main")
Chooser.Initialize("chooser")
For i = 1 To 10
MyCLV.Add(CreateListItem("MyText"&i),i)
Next
End Sub
Sub CreateListItem(Text As String) As Panel
Dim p As Panel
p.Initialize("")
p.SetLayout(0, 0, 100%x, 150dip)
p.LoadLayout("Item")
Button1.Text = Text
Button1.Tag = CLV_IV
Return p
End Sub
Sub CreateListItem2(btm As Bitmap) As Panel
Dim p As Panel
p.Initialize("")
p.SetLayout(0, 0, 100dip, 100dip)
p.LoadLayout("Item_IV")
ImageView1.Bitmap=btm
ImageView1.Tag=CLV_IV
Return p
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
Dim btn As Button = Sender
Dim index As Int = MyCLV.GetItemFromView(Sender)
Log("Checked items: " & index)
Chooser.Show("image/*", "Choose image")
Wait For chooser_Result (Success As Boolean, Dir As String, FileName As String)
If Success Then
Dim clv As CustomListView = btn.Tag
clv.Add(CreateListItem2(LoadBitmapResize(Dir,FileName,100dip,100dip,True)),0)
End If
End Sub
Sub ImageView1_Click
Dim iv As ImageView = Sender
Dim index As Int = MyCLV.GetItemFromView(Sender)
Log("Checked items: " & index)
End Sub