Android Question DraggableView Class interacting with other ImageViews objects?

Discussion in 'Android Questions' started by Mark Thorndyke, May 7, 2015.

  1. Mark Thorndyke

    Mark Thorndyke Member Licensed User

    I've used DraggableView class with success ( with a few bonuses added in to what I'm looking for.
    I'm currently struggling, or maybe being a bit to ambitious into trying the impossible and perhaps need to look at alternative methods?

    A quick overview:
    I create >=3 images that can be freely dragged across the screen and dropped on to 1 of 3 possible static images. Dragging ok via classes with z-order and so on with releasing.
    How is the best way to get this to reference any other ImageView or Panel outside the class to reference? Mainly for collisions and altering the objects it's interacting with appearance.

    It's easy enough to reference variables outside the class via process_globals but not ImageViews or Panels.

    Any suggestions?
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can pass a list to the class when you initialize it and later add other items to this list.

    As the list is passed by reference you will always be able to add or remove items from this list and all the class instances will work with the updated list.
  3. Mark Thorndyke

    Mark Thorndyke Member Licensed User

  4. Mark Thorndyke

    Mark Thorndyke Member Licensed User

    Thanks Erel for that. Had a play around with and works a treat. Thanks again for your quick response, muchly appreciated :)
  5. Mark Thorndyke

    Mark Thorndyke Member Licensed User

    Thinking further down the line for another project away from the current one.
    Is there a simplistic way for the following:

    Having a number of draggable items generated referencing the original link above.
    When an ACTION_DOWN occurs on one of these images created by the draggable class, it can reference one or more of the other draggable images using the same class and either disable and/or hide them. Seems simplistic but quick tests failed (including via lists but seem to get errors as referencing class objects, unless I've made a school boy error)
  6. Mark Thorndyke

    Mark Thorndyke Member Licensed User

    Phew, was a school boy on a list. A little more tinkering and answered own question.