Android Question From dynamic generated scrollview get current pressed event

Ferdari

Active Member
Licensed User
Longtime User
If i create dinamically scrollview, how do i return a click event from current pressed img or button?

B4X:
For i1 = 0 To 5

            Dim img As ImageView
            img.Initialize("img")
            img.Gravity=Gravity.FILL
          
            img.Bitmap=LoadBitmap(File.DirAssets , "image.webp")
          
            Dim pnl As HorizontalScrollView
            pnl.Initialize(500dip,"scroll"&i)
            pnl.Panel.Initialize("")

            appscrollpnl.Panel.AddView(pnl,10dip,topanel, Activity.Width - 20dip, 80dip)

            pnl.Panel.Width=480dip
            pnl.Width=Activity.Width-20dip
          
            pnl.Panel.AddView(img,left,0,80dip,80dip)
          
            left=left + 80dip
 Next

i want to do a sub that return the currently clicked, for ex the imgview pressed event for the pressed img.
or set another properties to imgview pressed by the event.

i was thinking doing a shared sub like
B4X:
Sub img_Click()
   Self.width(300dip) or this.width(300dip) or sender.width(300dip)
End

Thanks.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
Thanks @DonManfred, its working like charm, i haven't read the documentation, i work with too much programming languages.

Also im using your Stickers4Whats lib, its very good work,

this script generates dynamically the sticker packs, first, it reads the JSON file, then creates a horizontalscrollview with 6 images in pack + add to wa button for every sticker pack, i was working on this all day.

How are you doing to show the sticker packs in app?

i will send you a donation tomorrow(wed)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
How are you doing to show the sticker packs in app?
You should create a new thread for a new question. Additionally it is not related to this thread.

i´m not showing any Stickers. I just wrote the wrap as per request. I just use it in a private app to realize my own set of stickers in Whatsapp.
 
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
Just wanting to show what is achieved:


this list was generated from the JSON, from 15 packs, 385 images, now all works
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…