1000 Imageviews created by code loading pictures from a url

Discussion in 'Chit Chat' started by DonManfred, Feb 21, 2015.

  1. DonManfred

    DonManfred Expert Licensed User

    Code:
    Sub Button1_Click
        
    For i = 0 To 100
            
    Dim zufall As Int = Rnd(0, flist.Size)
            
    'Log(flist.Get(zufall))
            Dim img As ImageView
            img.Initialize(
    "iv")
            
    Dim posx As Int = Rnd(0,100%x-100dip)
            
    Dim posy As Int = Rnd(0,100%y-100dip)
            
    Activity.AddView(img,posx,posy,100dip,100dip)
            il.loadImg(
    "http://snapshots.basic4android.de/"&flist.Get(zufall),img)      
        
    Next
    End Sub
    il is of type uil. uil is an Acronym for UniversalImageLoader. uil is not released actually.


     
    Last edited: Feb 21, 2015
    KZero, eps, KMatle and 3 others like this.
  2. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Very nice.

    I think I saw a pussy cat (and HotShoe )! :D
     
    inakigarm and Peter Simpson like this.
  3. DonManfred

    DonManfred Expert Licensed User

    At 1152 images i ran OOM :)
     
    KMatle likes this.
  4. Erel

    Erel Administrator Staff Member Licensed User

    In order to avoid OOM you need to load each image and draw it with Canvas instead of adding an ImageView.
     
    Informatix likes this.
  5. sorex

    sorex Expert Licensed User

    That seems like a lot of images, wouldn't you ran out of memory faster with the regular method?

    What's the difference then? pushing them to OpenGL ?
     
  6. HotShoe

    HotShoe Well-Known Member Licensed User

    You never know where that guy is gonna show up...

    --- Jem
     
  7. DonManfred

    DonManfred Expert Licensed User

    you mean the pussy? Yeah :D lol
     
    HotShoe and Peter Simpson like this.
  8. DonManfred

    DonManfred Expert Licensed User

    Tell this the author if the lib ;-)
    I just wrote a wrapper which calls some of the methods of this lib.
    Code:
    il.loadImg("http://snapshots.basic4android.de/"&flist.Get(zufall),img)
    the uilobject (the wrapper) just call loadImg with the url and the reference to the imageview. Rest is done by the native jar
    But i did not test the content uris... First i need to figure out what the hell that is :) Honestly i did do do anything with that before :)
     
    Peter Simpson likes this.
  9. KMatle

    KMatle Expert Licensed User

    I have a scrollview. On it, I add panels at runtime and initialize canvases to it. On those canvases I use ONE Bitmap for all images and draw with it on them.

    As far as I understood, this is the optimal way?
     
  10. sorex

    sorex Expert Licensed User

    no, I think that Erel meant that it's better in that example to just copy it to the canvas.

    indeed, as long as they don't need to be clickable or movable you could just copy it to 1 canvas as the memory size of that won't change
    if you copy 1 or 5738 images to it.
     
    RandomCoder likes this.
  11. KZero

    KZero Active Member Licensed User

    when it will be available ?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice