Explicit Intent

PHOTO EMBED

Fri Apr 15 2022 01:27:39 GMT+0000 (UTC)

Saved by @anasrathore #kotlin

#Main Activity   
		var fname = findViewById(R.id.firstName) as EditText
        var email = findViewById(R.id.email) as EditText
        var submit = findViewById(R.id.go) as Button


        submit.setOnClickListener{
            var name = fname.text.toString()
            var email_des = email.text.toString()
            var intent = Intent(this, HomeActivity::class.java)
            intent.putExtra("name", name)
            intent.putExtra("email", email_des)
            startActivity(intent)
        }
#2nd activity to get data
        val name_display = findViewById(R.id.name_display) as TextView
        val email_display = findViewById(R.id.email_display) as TextView
        val btn = findViewById(R.id.next_id) as Button

        var name = intent.getStringExtra("name")
        var email = intent.getStringExtra("email")

         name_display.text = name
        email_display.text = email

        btn.setOnClickListener{
            val intent = Intent(this,ThirdActivity::class.java)
            startActivity(intent)
        }
#third

        val btn = findViewById(R.id.back_button) as Button

        btn.setOnClickListener{
            val intent = Intent(this,MainActivity::class.java)
            startActivity(intent)
        }
content_copyCOPY