Hello, i am very new at kotlin and i am wondering how i can add an second button (the function from the button not the button itself) to my MainActivity. I already have one but idk how to add a second one. Can someone maybe help me there?
The code from the MainActivity:
package com.example.myapplication
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebView
import android.widget.Button
class MainActivity2 : AppCompatActivity()
{
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main2)
val VerButton = findViewById<Button>(R.id.button3)
VerButton.setOnClickListener {
val Intent = Intent(this, MainActivity::class.java)
startActivity(Intent)
}
}
}
đ¶ 3
c
Chrimaeon
10/24/2022, 9:04 PM
Hi Moritz, this is the wrong workspace to ask such questions. This workspace and specially this channel is for specific Kotlin related questions. Yours is more like a general âHow do I implement something on Androidâ. Those questions are better ask in one of the links form the channel description.