Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Clear a View

Does anyone have some reliable code for clearing the contents of a view?

I am creating a gallery and I want to remove the imageView and add a new one to the scroll view.

I guess the other option is to change the image value of the imageView but I'm not sure how this is done…

— asked October 13th 2010 by John Welch
  • gallery
  • imageview

1 Answer

  • Figured out my issues…

    And this is how it is done:

    1. Pull from a database the list of photos including the location. Set an id of the gallery to get the proper list in the gallery view.
    2. Put the location of the items in an array (URL).
    3. Once the photo is selected figure out what the spot number is in the array for that photo.
    4. Add left and right buttons to traverse the gallery.
    5. Add events to those buttons getting the next or previous photo in the array. Change the spot use setString.
    6. Change the content of the views in use. Do not remove them, if you remove them you will have issues with events and the existence of views.

    Although I'm nearly finished building a web based gallery feature in Titanium I think this would be a great example for the KitchenSink (I'm sure I'm not doing everything perfect). I'm currently able to pull from Picasa or Flickr.

    Does anyone know how to implement left and right swipe similar to the native gallery?

    — answered October 13th 2010 by John Welch
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.