Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.azis.learn
- import android.content.Intent
- import androidx.appcompat.app.AppCompatActivity
- import android.os.Bundle
- import android.widget.Button
- import android.widget.EditText
- class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
- val button : Button = findViewById(R.id.buttonSend)
- val editText : EditText = findViewById(R.id.editTextText)
- // Mendapatkan teks dari EditText saat tombol diklik
- button.setOnClickListener {
- val inputText = editText.text.toString()
- // Membuat Intent untuk mengirimkan kembali teks ke ActivityA
- val intent = Intent(this, MainActivity2::class.java)
- intent.putExtra("textFromMainActivity2", inputText)
- startActivity(intent)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement