3
webdev
8y

why do you need to create an object to switch between activities? why?

Comments
  • 2
    Because that one android sdk designer that wakes up every morning and questioned himself how can I make people's life more miserable and complicated today?
  • 0
    @Kushtrim
    im sure there is more into it, but all i wanna do is swtich activity and send data to it, so as a front end guy openActivity('highscore', data); would be fine
    you get me :)
  • 1
    we kinda have to do this in iOS too, kinda....
    where we have a segue from one controller to another, we can call a function to prepare any required data before the segue is executed. we typically grab the destination viewcontroller which has been initialised at this point, and set its member variables appropriately. i kinda prefer this approach because it means the destination view doesnt have to do any weird initialisation of variables from the previous view in the stack. it all gets done before the new view is presented.
  • 1
    Maybe a simple pattern like this: make all activities implement the same interface.An app is just list of these interface references which can dynamically be managed... The interface can be used to pass data. @Kushtrim
Add Comment