I'm in the middle of developing my first app while i learn dev for Android. I chose to do a simple game but i'm looking for some guidance.
I have a firm understanding on Activities and Views, but i'm unsure what the best approach is in placing my code.
I have created a custom view called BoardView that will generate the background, initialize my game pieces that are bitmaps, implement the drag and drop features, and so on. Currently my activity is only creating the view.
I have actually created the logic of the game in a basic console java app but i'm unsure of where to to put this logic.
Should i initialize all my global values in the Activity and pass them to the View? Should i make them static?
Does anyone have any suggestions and best practices?
You can have your view inside the Activity as an inner class, that way the view class will have access to all the state of the activity. Alternatively, you can also pass your activity context to the view class and then using this reference perform a get/set on the state of the Activity.