Page2.java
unknown
java
9 months ago
2.1 kB
14
Indexable
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 Page2 extends AppCompatActivity {
String str_charName;
Intent goToPage2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_page2);
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;
});
str_charName = getIntent().getStringExtra("str_charName");
goToPage2 = getIntent();
TextView storyTextView = findViewById(R.id.storyTextView);
String story = "The gamer awakens in a sprawling medieval kingdom, dazed and confused. The castle towers loom over him, and the villagers look at him with suspicion. A faint glow surrounds him, marking him as a foreigner, or as they say, an 'alien'. He quickly realizes he’s in the world of his favorite game, Kingdom of Valor. As he explores, he’s attacked by guards mistaking him for a threat. Barely escaping, he hides in a dense forest where the sound of rushing water calms him momentarily.";
storyTextView.setText(story);
}
public void next(View v) {
Intent goToPage3 = new Intent(this, Page3.class);
goToPage3.putExtra("str_charName", str_charName);
startActivity(goToPage3);
}
public void back(View v) {
Intent goBackToMain = new Intent(this, MainActivity.class);
startActivity(goBackToMain);
}
}Editor is loading...
Leave a Comment