Loop through all subclasses in an Android view?
        Posted  
        
            by Slapout
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Slapout
        
        
        
        Published on 2010-04-08T02:36:51Z
        Indexed on 
            2010/04/08
            2:43 UTC
        
        
        Read the original article
        Hit count: 495
        
I’m working on a game for Android. To help implement it, my idea is to create a subclass of a view. I would then insert several instances of this class as children of the main view. Each instance would handle detecting when it was pressed (via OnTouchListener).
The problem I’m having now is how do I loop through all these sub-views so I can read their statuses and process them? (I.e. when they all reach a certain state something should happen).
Or is there a better way to have several objects on the screen that respond to touch and whose status I can check?
© Stack Overflow or respective owner