Skip to content Skip to sidebar Skip to footer

Having Issues Writing To Edittext In Kotlin

So I think I'm having some scoping issues. I'm trying to use the function setZipEdit to set the R.id.zipHolder editText in my activity. I'm just having issues in setting up the cod

Solution 1:

Ok, But using kotlinextension is a better way to do this, I think you need to do 2 things may solve your problem

first

import kotlinx.android.synthetic.main.activity_main2.*

I think which you have already done

second instead of initializing your Editext by findViewById direct use as

funsetZipEdit(zipEdit:String){
        Log.d("SZE",zipEdit)
        Log.d("mzh",mZipHold.toString())
         zipHolder.setText(zipEdit)

         //mZipHold.setText(zipEdit,TextView.BufferType.EDITABLE)

    }

you can access your views by only use their id. Let try this and let me know if works

Post a Comment for "Having Issues Writing To Edittext In Kotlin"