I'm beginner and I don't understand how objects in Android work.
For example, I'm trying to do simple game. Game has two teams and each team has two players. Every team has each turn of a game, and in each turn plays only one player, so I have to remember when it is each players turn and score of teams.
I'm thinking of creating the class Game, with variables NextTeam (where I store information about team which is playing next), NextFirstTeamPlayer, NextSecondTeamPlayer, FirstTeamScore and SecondTeamScore.
Also I have two activities which I need during the game. I start them and destroy them.
My questions are:
1) If I create object of Game class in one activity, will that object be destroyed when I destroy activity in which object was created?
2) What is the best way to pass that object from one activity to another? My only idea is to pass values of object variables to new activity which is started and in new activity create new object with passed values. Is there any better way to do it?
3) I would like to use Game class in few activities. I have declared class as separated Java file. How to include that file in every activity in which I want to use that class?