Android Question CustomListview from Erel example with item listview image button click image changer

Ivan Henderson

New Member
Licensed User
Having problem with xcustomlistview. How to make app with customlistview modify images in any of the loaded rows change to to a specific pic after clicking on button. My test app can only change the first row. Can not figure out how to change any specific image in the listview rows. See following partial listing of code; I'm a newbeee ofcourse). See listing of sction of code that attempts to change specific image files. Seems straight forward but I'm baffled. The program loads roughly 10+ images or more into listview panels but no sucess in changeing these images once they are loaded, except for one listview row. Cant seem to access the others.

The original code came from Erel's example mostly. Take a look at: Sub btn_Click, which does not work well.

Sub Btn1_Click

Dim pnl As Panel

pnl = CLV1.GetPanel(0)

ImageView1= pnl.GetView (0)
ImageView1.Bitmap = LoadBitmapResize(File.DirAssets,"skulledPlayer-1.bmp", 32dip, 32dip, True)

Log ("testview Btn1_Click")

End Sub
 

Attachments

  • SamplelistviewfromErel.zip
    81.1 KB · Views: 221

Mahares

Expert
Licensed User
Longtime User
Take a look at: Sub btn_Click, which does not work well.
Here is what your btn1 click event code should look like:
B4X:
Sub Btn1_Click    
    Dim index As Int = CLV1.GetItemFromView(Sender)
    Dim pnl As Panel=CLV1.GetPanel(index)
    Dim MyImageview As ImageView =pnl.GetView(0)
    MyImageview.Bitmap = LoadBitmapResize(File.DirAssets,"skulledPlayer-1.bmp", 32dip, 32dip, True)
End Sub
 
Upvote 0

Ivan Henderson

New Member
Licensed User
Holy smokes thank you. Now I have learned the folly of my ways.... I almost got it I right.
Perhaps I rely too much on graphical representations on OO problems. Did not fully understand the OO layers here! Thanks yo!
It worked perfectly.
 
Upvote 0
Top