I have RoomActivity and GameActivity. RoomActivity listen server commands. Server can send 2 commands: openGameActivity and closeGameActivity. This commands must to run only in RoomActivity. First command I do so (RoomActivity class):
if(request == "open")
{
Intent i = new Intent(this, GameActivity.class);
startActivity(i);
}
But I have problem with second command.
if(request == "close")
{
//What I must do here to return back to RoomActivity?
}
Structure:

Upd
About finish();
I cant’s use it because it’s static method:
RoomActivity:
GameActivity.finishAct();
GameActivity:
public static void finishAct()
{
//this.onBackPressed();
finish();//<====Cannot make a static reference to the non-static method finish() from the type Activity
}
Just end your
Activityby calling: