Issue
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
btnLogin.setOnClickLister {
val intent = Intent(this, homemenu::class.java)
startActivity(intent)
}
} }
I have set the button for the Intent function. But it is still an error how can I fix this. The task I just only want the button after click it will head to another activity. appreciate for helping
Solution
It is because btnLogin is not defined.
You should define btnLogin (from activity_main xml)
val btnLogin = findViewById(R.id.btnLogin) as Button
Rest is good.
Answered By - KpStar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.