android how to switch between activities

Java
Intent intent = new Intent(getApplicationContext(), ActivityToBeOpened.class);
startActivity(intent);
Source

Also in Java: