android - Expected resource of type ID -


i using anko build simple project. when try set id edittext getting following error.

ensures resource id's passed apis of right type; example, calling resources.getcolor(r.string.name) wrong.

import android.support.v7.app.appcompatactivity import android.os.bundle import org.jetbrains.anko.*  class mainactivity : appcompatactivity() {  override fun oncreate(savedinstancestate: bundle?) {     super.oncreate(savedinstancestate)     relativelayout {         edittext{             id = 1         }     } } } 

click here view error image format

you can either use id references (r.id.something) or negative integers -16777215 -1 (and ignore warning).

suitable negative integers can generated using view.generateviewid() method available since api 17. source code available here. you'll have remember generated values yourself.

generating r.id covered in other answers.

i trying same getting error

the video published on year ago , lint didn't warn kotlin code then.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -