Simple Calculator Project - Android

Hi I have a problem with following excersise:
I am at step 7 trying to access UI elements by utilizing the findViewById() function. But when trying to use EditText Class i get following problems:
-Function invocation ‘EditText(…)’ expected
-None of the following functions can be called with the arguments supplied…
-Expecting an element
So i checked my xml code and do not know what i have done wrong or where to look at.
According to my definition (literally 1-1 as described by codecademy) xml code is:


and my Java code:

package com.codeacademy.simplecalculator

import android.os.Bundle
import android.widget.EditText

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        EditText test = findViewById(; // what is wrong here!?


could anyone explain me what i have done wrong or show me where I should look at? according to the video the code posted there is different and when i do the 1 by 1 typing it all turns red…

Thank you in advance and sorry if I am too much of a nab, I literrally started learning programming a short while ago.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.