Page3.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 Page3 extends AppCompatActivity { String str_charName; Intent goToPage3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EdgeToEdge.enable(this); setContentView(R.layout.activity_page3); 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; }); goToPage3 = getIntent(); str_charName = goToPage3.getStringExtra("str_charName"); TextView storyTextView = findViewById(R.id.storyTextView); String story = "In the forest, he encounters a young warrior, " + str_charName + ", who saves him from wild beasts. He’s skeptical of his origins but sees his genuine confusion and offers to help. He reveals the kingdom’s prophecy about an “outsider” who will bring balance or destruction. As they talk, a bond forms between them, with him teaching him survival skills. Together, they decide to seek the king to explain his presence, but the journey won’t be easy."; storyTextView.setText(story); } public void next(View v) { Intent goToPage4 = new Intent(this, Page4.class); goToPage4.putExtra("str_charName", str_charName); startActivity(goToPage4); } public void back(View v) { Intent goBackToPage2 = new Intent(this, Page2.class); goBackToPage2.putExtra("str_charName", str_charName); startActivity(goBackToPage2); } }
Leave a Comment