Untitled

 avatar
unknown
plain_text
17 days ago
1.3 kB
4
Indexable
package com.crisostomo.storybook;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

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 MainActivity extends AppCompatActivity {
    EditText oneName;
    String str_twoName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        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;
        });
        oneName = (EditText) findViewById(R.id.oneName);
    }

    public void next(View v) {
        str_twoName = oneName.getText().toString();
        Intent goToPage2 = new Intent(this, Page2.class);
        goToPage2.putExtra("str_twoName", str_twoName);
        startActivity(goToPage2);
    }
}
Leave a Comment