Page4.java
package com.example.kingdom_iguiron; 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 Page4 extends AppCompatActivity { String str_charName; Intent goToPage4; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EdgeToEdge.enable(this); setContentView(R.layout.activity_page4); 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; }); goToPage4 = getIntent(); str_charName = goToPage4.getStringExtra("str_charName"); TextView storyTextView = findViewById(R.id.storyTextView); String story = "On their way to the capital, they are ambushed by soldiers. The gamer, initially clumsy, uses his knowledge of the game’s mechanics to fight back. With " + str_charName + " by his side, they defeat the soldiers and continue their journey. This victory earns him his trust, and he shares more about his own struggles in the kingdom. However, he realizes the kingdom views him as a threat, and the king may not welcome him as they hope."; storyTextView.setText(story); } public void next(View v) { Intent goToPage5 = new Intent(this, Page5.class); goToPage5.putExtra("str_charName", str_charName); startActivity(goToPage5); } public void back(View v) { Intent goBackToPage3 = new Intent(this, Page3.class); goBackToPage3.putExtra("str_charName", str_charName); startActivity(goBackToPage3); } }
Leave a Comment