Page 1 - java
import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; import androidx.activity.EdgeToEdge; import androidx.appcompat.app.AppCompatActivity; import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; public class page1 extends AppCompatActivity { Intent i; String str_playerName; TextView tv_playerName; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EdgeToEdge.enable(this); setContentView(R.layout.activity_page1); ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> { Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); return insets; }); tv_playerName = (TextView)findViewById(R.id.tv_playerName); i = getIntent(); str_playerName = i.getStringExtra("str_playerName"); tv_playerName.setText("The Vanilla Kingdom stands peaceful for more than 1000 years after the great cookie war." + str_playerName + " cookie enjoyed his life with his friends."); } public void bt_next1 (View view) { Intent i = new Intent(this, page2.class); i.putExtra("str_playerName", str_playerName); startActivity(i); } public void bt_back1 (View view) { Intent i = new Intent(this, MainActivity.class); i.putExtra("str_playerName", str_playerName); startActivity(i); } }
Leave a Comment