I have this activity which is called MainPutShipActivity
and I want to start it again so it will do the same thing but it doesn't even enter the OnCreate
method.
here is the MainPutShipActivity
:
public class MainPutShipActivity extends Activity implements OnClickListener{
private static final int MAX = 10;
private String name1,name2;
private Player plr = new Player();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_put_ship);
Intent intent = getIntent();
plr = (Player) intent.getSerializableExtra("player");
name1 = plr.getName1();
name2 = plr.getName2();
}
public void finished() {
Intent in;
}
if (plr.isTreated() == false) {
plr.setArr1(arr);
plr.setShip1(ships);
this.finish();
in = new Intent(this,MainPutShipActivity.class);
in.putExtra("player", this.plr);
}
else {
plr.setArr2(arr);
plr.setShip2(ships);
in = new Intent(this, MainGameActivity.class);
in.putExtra("player", this.plr);
}
plr.setTreated(true);
this.finish();
startActivity(in);
}
When i enter the finished()
procedure for the first time it suppose to start the MainPutShipActivity
again but when it starts the activity, it skips the onCreate and goes straight to the finished() method for some reason.
I would be very glad for any kind of help.